Table of Contents


Sharepoint

This article shows how you can connect with Sharepoint from Magentrix to access Sharepoint libraries.

Using "SharePointManager" class you can get a list of files in a library and also download files from Sharepoint.

In order to do so, first you need to provide your Sharepoint credentials to the system using the "Connected Apps" section:
 

 Setup => Extend => Connected Apps

Create a new "Connected App", select "API Provider", type: "Basic". Enter your Sharepoint endpoint: "https://<instance>.sharepoint.com/" and your username/password for API integration.

What's important here is the name you give to this record, you will need to use this name to reference your Sharepoint credentials.

Below example shows how you can work with "SharePointManager" and use your credentials entered into the "Connected App":

var sharepoint = new SharePointManager("Connected App Name");

var siteName = "marketing";
var listId = "87127392-013c-484f-a53c-e278c161ffad";

//returns a list of SharePointFile objectsvar files = sharepoint.GetFiles(siteName, listId);

 

SharePointManager

MethodArgumentsReturns
GetFilesstring siteName,
string listId

List<SharePointFile>

Download

string siteName,
string listId,
string itemId

Byte[]

  

 

 

SharePointFile

Below outlines the properties of the SharePointFile class: 

PropertyTypeNotes
Idint

 

Name

string

 

Titlestring 
ContentTypestring 
FileRefstringdownload URL

MajorVersion

int 

MajorVersion

int 

LastModifiedOn

DateTime