Show: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MSGraphClient
Created by programaths on 17.03.23.
Signature
global with sharing class MSGraphClient
Enums
MSGraphClient MethodsarrayOfCcRecipients(p)
Signature
global static List<CcRecipients> arrayOfCcRecipients(System.JSONParser p)
parseArray(p)
Signature
global static List<Object> parseArray(JSONParser p)
parseMap(p)
Signature
global static Map<String,Object> parseMap(JSONParser p)
MSGraphClient.AddEntryToListResponse
Signature
global class AddEntryToListResponse
MSGraphClient.AddEntryToListResponse Properties
MSGraphClient.AddEntryToListResponse Methods
isError()
Signature
global Boolean isError()
isError(errorCode)
checks if there is an error with a certain error-code present
Signature
global Boolean isError(String errorCode)
MSGraphClient.AddMemberData
Signature
global class AddMemberData
MSGraphClient.AddMemberData Properties
MSGraphClient.AddMemberData ConstructorsAddMemberData(parser)
Signature
global AddMemberData(JSONParser parser)
MSGraphClient.AddMemberData MethodsparseChannelList(parser)
Signature
global static List<ChannelData> parseChannelList(JSONParser parser)
parseMemberList(parser)
Signature
global static List<Member> parseMemberList(JSONParser parser)
parseSharepointListList(parser)
Signature
global static List<SharePointList> parseSharepointListList(JSONParser parser)
MSGraphClient.AddMemberResponse
Signature
global class AddMemberResponse
MSGraphClient.AddMemberResponse Properties
MSGraphClient.AddMemberResponse Methods
isError()
Signature
global Boolean isError()
isError(errorCode)
checks if there is an error with a certain error-code present
Signature
global Boolean isError(String errorCode)
MSGraphClient.CcRecipients
Signature
global class CcRecipients
MSGraphClient.CcRecipients Properties
MSGraphClient.CcRecipients ConstructorsCcRecipients(parser)
Signature
global CcRecipients(JSONParser parser)
MSGraphClient.ChannelData
Signature
global class ChannelData
MSGraphClient.ChannelData Properties
Enums
MSGraphClient.ChannelData ConstructorsChannelData()
Signature
global ChannelData()
ChannelData(parser)
Signature
global ChannelData(JSONParser parser)
MSGraphClient.ChannelData MethodstoJson()
Signature
global String toJson()
MSGraphClient.ChannelDataResponse
Signature
global class ChannelDataResponse
MSGraphClient.ChannelDataResponse Properties
MSGraphClient.ChannelDataResponse Methods
isError()
Signature
global Boolean isError()
isError(errorCode)
checks if there is an error with a certain error-code present
Signature
global Boolean isError(String errorCode)
MSGraphClient.ChannelResponseData
Signature
global class ChannelResponseData
MSGraphClient.ChannelResponseData Properties
MSGraphClient.ChannelResponseData ConstructorsChannelResponseData(parser)
Signature
global ChannelResponseData(JSONParser parser)
MSGraphClient.CreateUploadSessionResponse
Signature
@JsonAccess(Serializable='always' Deserializable='always')
global class CreateUploadSessionResponse
MSGraphClient.CreateUploadSessionResponse Properties
MSGraphClient.CreateUploadSessionResponse Methods
isError()
Signature
global Boolean isError()
isError(errorCode)
checks if there is an error with a certain error-code present
Signature
global Boolean isError(String errorCode)
MSGraphClient.DeleteSharingPermissionResponse
Signature
@JsonAccess(Serializable='always' Deserializable='always')
global class DeleteSharingPermissionResponse
MSGraphClient.DeleteSharingPermissionResponse Properties
MSGraphClient.DeleteSharingPermissionResponse Methods
addChannel(userId, channelData)
Add a channel to a Team.
Signature
global ChannelDataResponse addChannel(String userId, ChannelData channelData)
Parameters
userId
Type:
String
channelData:
see usage below
Returns
ChannelDataResponse: Object containing the Channel Id or the error. Make sure to save the channelId in Salesforce!
Example
addEntryToList(userId, siteId, listId, fields)
This method provides a convenient and reusable way of sending different types of JSON requests to Microsoft Graph API and handling their responses.
Signature
global AddEntryToListResponse addEntryToList(String userId,String siteId,String listId,Map<String,Object> fields)
Parameters
userId
Type:
String
User Id
method
Http Method (GET, POST, PATCH ...)
endpoint
the URI (without server prefix)
body
the request body to send
Returns
ResponseOrError - This is a custom type which encapsulates the response or error from the HTTP request. If the request is successful (HTTP status codes 200-299), the 'response' field of the returned 'ResponseOrError' object will hold the HttpResponse. If there is an error (response body is not a json or an unsuccessful HTTP status code), the 'error' field of the returned 'ResponseOrError' object will hold the error details.
addMemberToChannel(userId, teamId, channelId, member)
This method is used to add a member to a channel. The user must be a member of the Team!
Signature
global AddMemberResponse addMemberToChannel(String userId,String teamId,String channelId,Member member)
Parameters
userId:
The ID of the user performing the operation.
teamId:
The ID of the team in which the channel exists.
channelId:
The ID of the channel where the member is to be added.
member:
The Member object containing the details of the member to be added identified via email.
Returns
AddMemberResponse A response object containing the result of the operation.
Example
addMemberToTeam(userId, teamId, member)
This method adds a member to a team.
Signature
global AddMemberResponse addMemberToTeam(String userId,String teamId,Member member)
Parameters
userId:
The ID of the user to be added to the team.
teamId:
The ID of the team where the user is to be added.
member:
The member to add, identified by email address.
Returns
AddMemberResponse A response object containing the result of the operation.
Example
addTeam(userId, teamData)
This method is used to add a new team. According to O365 documentation, the creation of a team can take between 0 seconds and 5 minutes!
Signature
global TeamDataResponse addTeam(String userId,TeamData teamData)
Parameters
userId:
Id of the Salesforce user you want to use to generate the team with.
TeamData:
Information required for the team to be generated
Returns
AddTeamResponse An object containing the result of the operation. Make sure to store the teamId in a field in Salesforce for later reference
Example
cadmus_una_createSharingLink(userId, driveId, itemId)
Signature
global CollabMSGraphClient.CreateLinkResponse cadmus_una_createSharingLink(String userId, String driveId, String itemId)
cleanCredentials(userId)
This global method resets the Salesforce access-token, code-verifier, redirect URL and the refresh token for a specific user to empty strings.
Signature
global void cleanCredentials(String userId)
Parameters
userId
Type:
String
The unique identifier for a particular user in Salesforce.
Example
clearCredentials(userId)
Signature
global void clearCredentials(String userId)
commitRefreshToken()
Call this method after calling multiple methods on the SharePoint API, just to make sure the credentials are updated and this action has to happens once for all API calls.
Signature
global void commitRefreshToken()
Example
createChatMessage(userId, channelName, htmlMessage)
Signature
global CollabMSGraphClient.CreateChatMessageResponse createChatMessage(String userId,String channelName,String htmlMessage)
Parameters
userId
Type:
String
UserId or empty for "current user"
channelName
Channel name
htmlMessage
Message in HTML
Returns
Completion status
Example
createChatMessageWithQueue(userId, channelName, htmlMessage, queueable)
Signature
global CollabMSGraphClient.CreateChatMessageResponse createChatMessageWithQueue(String userId,String channelName,String htmlMessage,List<Queueable> queueable)
createDraftEmail(userId, emailMessage)
Create a draft email.
Signature
global CollabMSGraphClient.CreateDraftEmailResponse createDraftEmail(String userId,Messaging.SingleEmailMessage emailMessage)
Parameters
userId
Type:
String
User Id to euthenticate with
emailMessage
Email message to be saved in drafts
Returns
Draft Id.
createFolder(userId, driveId, parentId, name)
Create folder "name" in drive identified by "driveId" with parent identified by "parentId"
Signature
global CollabMSGraphClient.SaveFileResponse createFolder(String userId, String driveId, String parentId, String name)
Parameters
userId
Type:
String
user ID
driveId
Type:
String
drive ID
parentId
Type:
String
parent ID
name
Type:
String
folder name
Returns
created folder
Example
createMock(stubProvider)
the unit test stub which implements the mock methods
Signature
global static MSGraphClient createMock(StubProvider stubProvider)
Parameters
stubProvider
Type:
StubProvider
use the default Stub from COLLABORATION Butler "new MSGraphClient.MSGraphClientStub()". Or create your own Stub for each method you want to use.
Returns
Mock
Example
createSharingLink(userId, driveId, itemId)
Creates a sharing link for a specific item stored in a drive. This global method acts as a wrapper or proxy that facilitates the interaction with the Microsoft Graph API through the 'CollabMSGraphClient' class. By providing the necessary identifiers, users can generate a link that allows for sharing access to a file or folder located within a specified drive.
Signature
global CollabMSGraphClient.CreateLinkResponse createSharingLink(String userId, String driveId, String itemId)
Parameters
userId
Type:
String
The unique identifier of the user on behalf of whom the operation is performed. The method uses this ID to authenticate and authorize the request, ensuring the user has the necessary permissions to create a sharing link for the item.
driveId
Type:
String
The unique identifier of the drive within which the item resides. This ID helps in locating the drive in the system and identifying the item that needs to be shared.
itemId
Type:
String
The unique identifier of the item (file or folder) for which the sharing link is created. This ID is crucial in pinpointing the exact item in the drive.
Returns
A 'CreateLinkResponse' object that contains the response from the 'createSharingLink' method of the 'CollabMSGraphClient'. It includes details such as the sharing link itself, any permissions associated with the link, and other relevant metadata regarding the sharing operation.
Example
createSharingLink(userId, siteDrive, expiry, userEmails, accessType)
@return
Signature
@Deprecated
global CollabMSGraphClient.CreateLinkResponse createSharingLink(String userId,String siteDrive,Datetime expiry,List<String> userEmails,CollabMSGraphClient.ShareAccessType accessType)
Parameters
userId
Type:
String
siteDrive
expiry
userEmails
accessType
createSharingLink(userId, driveId, itemId, expiryDate, userEmails, accessType)
Create a sharing link in SharePoint @return
Signature
global CollabMSGraphClient.CreateLinkResponse createSharingLink(String userId, String driveId, String itemId,Datetime expiryDate,List<String> userEmails,CollabMSGraphClient.ShareAccessType accessType)
Parameters
userId
Type:
String
user to create sharing link with
driveId
Type:
String
See example on how to retrive the Drive Id
itemId
Type:
String
See example on how to retrive the item Id, this can be a file or folder
expiryDate
DateTime 24 hours in the future, ignored when sharing is not anonymous or Site does not allow to share with anonymous
userEmails
list of email addresses to share with. Leave empty when anonymous.
accessType
View are edit
Example
createSharingLink(userId, driveId, itemId, expiryDate, userEmails)
Create a sharing link in SharePoint @return
Signature
global CollabMSGraphClient.CreateLinkResponse createSharingLink(String userId, String driveId, String itemId,Datetime expiryDate,List<String> userEmails)
Parameters
userId
Type:
String
user to create sharing link with
driveId
Type:
String
See example on how to retrive the Drive Id
itemId
Type:
String
See example on how to retrive the item Id, this can be a file or folder
expiryDate
DateTime 24 hours in the future, ignored when sharing is not anonymous or Site does not allow to share with anonymous
userEmails
list of email addresses to share with. Leave empty when anonymous.
Example
createSharingLinkFromLibraryAndPath(userId, libraryUrl, path, expiryDate, userEmails, accessType)
Signature
global CollabMSGraphClient.CreateLinkResponse createSharingLinkFromLibraryAndPath(String userId, String libraryUrl, String path,Datetime expiryDate,List<String> userEmails,CollabMSGraphClient.ShareAccessType accessType)
createUploadSession(userId, driveId, parentItemId, fileName)
Signature
global CreateUploadSessionResponse createUploadSession(String userId,String driveId,String parentItemId,String fileName)
deleteSharingPermission(userId, sharingLink)
@return
Signature
global DeleteSharingPermissionResponse deleteSharingPermission(String userId,String sharingLink)
Parameters
userId
Type:
String
sharingLink
Example
deleteSharingPermissionsByEmail(userId, item, email)
Removes sharing permissions for a specific email on a Microsoft Graph Drive Item. This method iterates over all the sharing permissions of a given item and deletes the permissions associated with the specified email address.
Signature
global DeleteSharingPermissionResponse deleteSharingPermissionsByEmail(String userId,CollabMSGraphClient.GetDriveResponseData item,String email)
Parameters
userId
Type:
String
The user ID for which the operation is performed. If blank, it defaults to the current user's ID.
item
The drive item for which permissions need to be modified, encapsulated in a GetDriveResponseData object.
email
The email address for which the sharing permissions will be deleted.
Returns
DeleteSharingPermissionResponse This response object includes details about the operation's success or failure.
Example
ensurePath(userId, driveId, path)
Ensures that the given path exists in the specified drive. If any folder in the path doesn't exist, this method attempts to create it.
Signature
global Boolean ensurePath(String userId, String driveId, String path)
Parameters
userId
Type:
String
The user ID for which the path should be ensured.
driveId
Type:
String
The drive ID in which the path should be ensured.
path
Type:
String
The path to be ensured, with each folder separated by a forward slash (/).
Returns
true if the path exists or has been successfully created, false otherwise.
Example
getDrive(userId, siteUrl)
Get drive from URL. You probably do not want to use this. #getSiteDrive()
Signature
global CollabMSGraphClient.GetDriveResponse getDrive(String userId, String siteUrl)
Parameters
userId
Type:
String
user Id
siteUrl
Type:
String
site URL
Returns
corresponding drive
See
CollabMSGraphClient.getSiteDrive()
getDriveItemByPath(userId, driveId, path)
Retrieve drive item in drive "driveId" at path <var>path</var>
Signature
global CollabMSGraphClient.GetDriveResponse getDriveItemByPath(String userId, String driveId, String path)
Parameters
userId
Type:
String
User Id
driveId
Type:
String
drive ID
path
Type:
String
path
Returns
drive item at path <var>path</var>. See: GetDriveResponse
Example
getDriveItemsById(userId, driveId, childId)
Signature
global CollabMSGraphClient.GetDriveContentResponse getDriveItemsById(String userId, String driveId, String childId)
getDriveItemsByPath(userId, driveId, path)
Retrieve drive items (children) in drive "driveId" at path <var>path</var>
Signature
global CollabMSGraphClient.GetDriveContentResponse getDriveItemsByPath(String userId, String driveId, String path)
Parameters
userId
Type:
String
User Id
driveId
Type:
String
drive ID
path
Type:
String
path
Returns
drive items (children) at path <var>path</var>. See: GetDriveContentResponse
See
CollabMSGraphClient.getDriveItemByPath to get the item itself
Example
getDriveItemsByPathFiltered(userId, driveId, path, wildcard)
Fetches and filters DriveItems from a specific path in a user's Drive. The glob pattern rules are: - '*' matches any string of characters - '?' matches any single character
Signature
global CollabMSGraphClient.GetDriveContentResponse getDriveItemsByPathFiltered(String userId, String driveId, String path,String wildcard)
Parameters
userId
Type:
String
A String representing the unique identifier of a User.
driveId
Type:
String
A String representing the unique identifier of a Drive.
path
Type:
String
A String representing the path in the Drive where items are located.
wildcard
A String which is a glob pattern, used for filtering DriveItems based on their names.
Returns
Returns a GetDriveContentResponse object, which contains the list of filtered DriveItems. If there's an error during the request, the GetDriveContentResponse will contain the error details.
Example
getEntryFromList(userId, siteId, listId, itemId)
Retrieves a specific item from a specified list on a specific site.
Signature
global GetEntryFromListResponse getEntryFromList(String userId,String siteId,String listId,String itemId)
Parameters
userId
Type:
String
The identifier of the user. This is used for authentication purposes and must be valid.
siteId
The identifier of the site where the list is located. The site must exist and the user must have appropriate permissions.
listId
The identifier of the list from where the item will be fetched. The list must exist within the specified site.
itemId
The identifier of the item to be retrieved from the list.
Returns
GetEntryFromListResponse An instance of the GetEntryFromListResponse class. If the operation is successful, the 'error' field of the response will be null, and the 'data' field will contain the details of the list item requested. If there was an error (such as an invalid list Item Id, insufficient permissions, etc.), the 'error' field will contain details of the error, and the 'data' field will be null.
Example
getFile(userId, url, isLibrary, path)
Gets a SharePoint file
Signature
global CollabMSGraphClient.GetFileResponse getFile(String userId, String url, Boolean isLibrary, String path)
Parameters
userId
Type:
String
the user of which the SharePoint credentials should be used. Current user: UserInfo.getUserId()
url
Type:
String
Site Library Url
isLibrary
Type:
Boolean
unless you are using an old version, use "true"
path
Type:
String
sharepoint library folder patch
Returns
GetFileResponse object
Example
getFileAsPDF(userId, url, isLibrary, path)
Converts a SharePoint file into PDF - Remote Site Setting: https://westeurope1-mediap.svc.ms
Signature
global CollabMSGraphClient.GetFileResponse getFileAsPDF(String userId, String url, Boolean isLibrary, String path)
Parameters
userId
Type:
String
the user of which the SharePoint credentials should be used. Current user: UserInfo.getUserId()
url
Type:
String
Site Library Url
isLibrary
Type:
Boolean
unless you are using an old version, use "true"
path
Type:
String
sharepoint library folder patch
Returns
GetFileResponse object
Example
getListsFromSite(userId, siteId)
Retrieves the lists from a specified site.
Signature
global GetListsFromSiteResponse getListsFromSite(String userId,String siteId)
Parameters
userId
Type:
String
The identifier of the user. This is used for authentication purposes and must be valid.
siteId
The identifier of the site where the lists will be retrieved from. The site must exist and the user must have the appropriate permissions.
Returns
GetListsFromSiteResponse An instance of the GetListsFromSiteResponse class. If the operation is successful, the 'error' field of the response will be null, and the 'data' field will contain the lists retrieved from the site. If there was an error during the retrieve operation (such as an invalid site Id, insufficient permissions, etc.), the 'error' field will contain details of the error, and the 'data' field will be null.
Example
getMetadataColumns(userId, driveId, itemId, columns)
Fetches metadata columns for the specified list item in Microsoft Graph. @throws IllegalArgumentException If any of the required parameters (siteId, listId, itemId) are null or empty. @throws MSGraphClientException If an error occurs while communicating with the Microsoft Graph API.
Signature
global ListItemDataResponse getMetadataColumns(String userId,String driveId,String itemId,Set<String> columns)
Parameters
siteId
The unique identifier of the SharePoint site.
driveId
The unique identifier of the Document Library within the SharePoint site.
itemId
The unique identifier of the item within the Document Library. Folder or file.
selectColumns
A set of column names to retrieve metadata for. If null or empty, all columns' metadata will be fetched.
Returns
An instance of
MSGraphClient.ListItemDataResponse containing the metadata for the specified columns. the "fields" will be a map<String, Object> of the column and value
Example
getRefreshedToken(userId)
Signature
global String getRefreshedToken(String userId)
getSharingPermission(userId, sharingLink)
Signature
global GetSharingPermissionResponse getSharingPermission(String userId,String sharingLink)
Parameters
userId
Type:
String
sharingLink
Returns
sharing link permission
Example
getSharingPermissions(userId, itemId)
@return
Signature
global GetSharingPermissionsResponse getSharingPermissions(String userId,CollabMSGraphClient.GetDriveResponseData itemId)
Parameters
userId
Type:
String
itemId
Example
getSite(userId, siteUrl)
Retrieves the site information by given URL.
Signature
global GetSiteResponse getSite(String userId,String siteUrl)
Parameters
userId
Type:
String
The identifier of the user. This is used for authentication purposes and must be valid.
siteUrl
The URL of the site to be retrieved. The site must exist and the user must have appropriate permissions.
Returns
GetSiteResponse An instance of the GetSiteResponse class. If the operation is successful, the 'error' field of the response will be null. If there was an error during the retrieval operation (such as an invalid Site URL, insufficient permissions, etc.), the 'error' field will contain details of the error.
Example
getSiteDrive(userId, libraryUrl)
Get drive from URL, tacking into account sites and libraries.
Signature
global CollabMSGraphClient.GetDriveResponse getSiteDrive(String userId, String libraryUrl)
Parameters
userId
Type:
String
user Id
libraryUrl
Type:
String
site/library URL
Returns
corresponding drive: GetDriveResponse
Example
grantSharingLinkAccess(userId, sharingLink, userEmails)
Create a sharing link in SharePoint @return
Signature
global CollabMSGraphClient.GrantSharingLinkResponse grantSharingLinkAccess(String userId,String sharingLink,List<String> userEmails)
Parameters
userId
Type:
String
user to create sharing link with
sharingLink
Link you get after creating a sharing
userEmails
list of email addresses to share with. Leave empty when anonymous.
Example
grantSharingLinkAccess(userId, sharingLink, userEmails, accessType)
Create a sharing link in SharePoint @return
Signature
global CollabMSGraphClient.GrantSharingLinkResponse grantSharingLinkAccess(String userId,String sharingLink,List<String> userEmails,CollabMSGraphClient.ShareAccessType accessType)
Parameters
userId
Type:
String
user to create sharing link with
sharingLink
Link you get after creating a sharing
userEmails
list of email addresses to share with. Leave empty when anonymous.
accessType
the access type
Example
inviteGuest(userId, inviteRedirectUrl, member)
Invite Guest user to O365
Signature
global InviteGuestResponse inviteGuest(String userId,String inviteRedirectUrl,Member member)
Parameters
userId
Type:
String
inviteRedirectUrl
member
Returns
InviteGuestResponse: will have the O365 userId of the invited guest. Best this id is stored on the User SObject in SFDC.
Example
isError()
Signature
global Boolean isError()
isError(errorCode)
checks if there is an error with a certain error-code present
Signature
global Boolean isError(String errorCode)
isSubsite(domain, siteName, possibleSubSiteName, token)
Signature
global Boolean isSubsite(String domain,String siteName,String possibleSubSiteName,String token)
Parameters
domain
Type:
String
Sharepoint domain
siteName
Sharepoint site
possibleSubSiteName
Sharepoint subsite
token
Sharepoint auth token
Returns
Whether <var>possibleSubSiteName</var> is a sub site of <var>siteName</var> for domain <var>domain</var>
See
CollabOAuthController.getSavedToken
isTokenValid(userId)
Signature
global Boolean isTokenValid(String userId)
listTeamChannelMembers(userId, teamId, channelId)
List all members for a channel
Signature
global ListMembersResponse listTeamChannelMembers(String userId,String teamId,String channelId)
Parameters
userId
Type:
String
teamId
channelId
Returns
ListMembersResponse
Example
listTeamChannels(userId, teamId)
List all channels linked to a Team @return
Signature
global ListTeamChannelsResponse listTeamChannels(String userId,String teamId)
Parameters
userId
Type:
String
teamId
Example
listTeamMembers(userId, teamId)
List all members for a team
Signature
global ListMembersResponse listTeamMembers(String userId,String teamId)
Parameters
userId
Type:
String
teamId
Returns
ListMembersResponse
Example
prepareRefreshToken(userId)
Call this method before calling multiple methods on the SharePoint API, just to make sure the credentials are up to date and this action has to happens once for all API calls.
Signature
global void prepareRefreshToken(String userId)
Parameters
userId
Type:
String
User to call the SharePoint API with.
Example
refreshTokenWithQueue(userId, queueables)
Signature
global String refreshTokenWithQueue(String userId,List<Queueable> queueables)
removeMemberFromTeam(userId, teamId, membershipId)
Removes a member of a team
Signature
global RemoveMemberResponse removeMemberFromTeam(String userId,String teamId,String membershipId)
Parameters
userId
Type:
String
teamId
membershipId
Returns
RemoveMemberResponse
Example
removeMemberFromTeamChannel(userId, teamId, channelId, membershipId)
Remove a member from a Channel
Signature
global RemoveMemberResponse removeMemberFromTeamChannel(String userId,String teamId,String channelId,String membershipId)
Parameters
userId
Type:
String
teamId
channelId
membershipId
Returns
RemoveMemberResponse
Example
renameFolder(userId, url, isLibrary, basePath, sourceName, targetName)
Change the name of folder in a SharePoint Library
Signature
global static CollabMSGraphClient.SaveFileResponse renameFolder(String userId,String url, Boolean isLibrary, String basePath, String sourceName,String targetName)
Parameters
userId
Type:
String
User ID
url
URR
isLibrary
Type:
Boolean
Is <var>url</var> pointing to a Library ?
basePath
Type:
String
Path to folder containing the driveItem to rename
sourceName
Type:
String
driveItem source name
targetName
driveItem desired name
Returns
changed driveItem, the id field contains the list item id
Example
sanitizeFileName(dirtyFilename)
General cleanup of characters SharePoint cannot deal with
Signature
global String sanitizeFileName(String dirtyFilename)
Parameters
dirtyFilename
Type:
String
Filename without the path
Returns
clean URL
Example
sanitizeFolderName(dirtyFolderName)
General cleanup of characters SharePoint cannot deal with
Signature
global String sanitizeFolderName(String dirtyFolderName)
Parameters
dirtyFolderName
Type:
String
Folder name not the entire path
Returns
clean URL
sanitizeFolderPath(dirtyFolderPath)
General cleanup of characters SharePoint cannot deal with
Signature
global String sanitizeFolderPath(String dirtyFolderPath)
Parameters
dirtyFolderPath
Type:
String
Url path of the folder without filename (use{@link CollabMSGraphClient.sanitizeFileName})
Returns
clean URL
Example
saveFile(userId, url, isLibrary, path, fileContent)
Saves a file to the specified path in a drive or document library.
Signature
global CollabMSGraphClient.SaveFileResponse saveFile(String userId, String url, Boolean isLibrary, String path, Blob fileContent)
Parameters
userId
Type:
String
The user ID for which the file should be saved.
url
Type:
String
The URL of the SharePoint site or document library where the file should be saved.
isLibrary
Type:
Boolean
A boolean indicating whether the destination is a document library (true) or a SharePoint site (false).
path
Type:
String
The path to save the file, including the file name and extension.
fileContent
Type:
Blob
The content of the file as a Blob.
Returns
A SaveFileResponse object containing either the saved file's metadata or an error object.
Example
saveFile(userId, driveUrl, path, fileContent)
Signature
global CollabMSGraphClient.SaveFileResponse saveFile(String userId, String driveUrl, String path, Blob fileContent)
saveFileById(userId, driveId, parentId, fileName, fileContent)
Save file in a site drive using IDs
Signature
global CollabMSGraphClient.SaveFileResponse saveFileById(String userId, String driveId, String parentId, String fileName, Blob fileContent)
Parameters
userId
Type:
String
user ID
driveId
Type:
String
drive ID
parentId
Type:
String
parent ID
fileName
Type:
String
file name
fileContent
Type:
Blob
file content
Returns
saved file
sendDraftEmail(userId, draftId)
Signature
global CollabMSGraphClient.SendEmailResponse sendDraftEmail(String userId,String draftId)
sendEmail(userId, emailMessage)
Send an email.
Signature
global CollabMSGraphClient.SendEmailResponse sendEmail(String userId,Messaging.SingleEmailMessage emailMessage)
Parameters
userId
Type:
String
User Id to authenticate with
emailMessage
Email message to be saved in drafts
Returns
Draft Id.
updateContentType(userId, driveId, itemId, contentTypeId)
Update ContentType for file in a site drive using IDs. Warning: the files has to be part of a LIST.
Signature
global CollabMSGraphClient.SaveFileResponse updateContentType(String userId,String driveId, String itemId,String contentTypeId)
Parameters
userId
Type:
String
user ID
driveId
drive ID
itemId
Type:
String
parent ID
contentTypeId
custom ContentType for file
Returns
saved file, the id field contains the list item id
updateEntryInList(userId, siteId, listId, itemId, fields)
Updates a specific item in a specified list on a specific site.
Signature
global UpdateEntryToListResponse updateEntryInList(String userId,String siteId,String listId,String itemId,Map<String,Object> fields)
Parameters
userId
Type:
String
The identifier of the user. This is used for authentication purposes and must be valid.
siteId
The identifier of the site where the list is located. The site must exist and the user must have appropriate permissions.
listId
The identifier of the list where the item will be updated. The list must exist within the specified site.
itemId
The identifier of the item to be updated in the list.
fields
A Map of fields for the list item to be updated. Each entry in the map represents a field, where the key is the field name and the value is the new field value.
Returns
UpdateEntryToListResponse An instance of the UpdateEntryToListResponse class. If the operation is successful, the 'error' field of the response will be null. If there was an error during the update operation (such as an invalid list Item Id, insufficient permissions, etc.), the 'error' field will contain details of the error.
Example
updateMetadataColumns(userId, driveId, itemId, fields)
Signature
global CollabMSGraphClient.SaveFileResponse updateMetadataColumns(String userId,String driveId,String itemId,Map<String,Object> fields)
urlEncodeFilePath(url)
Signature
global String urlEncodeFilePath(String url)
MSGraphClient.DriveItemPermission
Signature
@JsonAccess(Serializable='always' Deserializable='always')
global class DriveItemPermission
MSGraphClient.DriveItemPermission Properties
MSGraphClient.DriveItemPermission ConstructorsDriveItemPermission(parser)
Signature
global DriveItemPermission(JSONParser parser)
DriveItemPermission()
Signature
return new DriveItemPermission(parser)
MSGraphClient.DriveItemPermission Methodsparse(jsonString)
Signature
global DriveItemPermission parse(String jsonString)
MSGraphClient.DriveItemPermissions
Signature
@JsonAccess(Serializable='always' Deserializable='always')
global class DriveItemPermissions
MSGraphClient.DriveItemPermissions Properties
MSGraphClient.EmailAddress
Signature
global class EmailAddress
MSGraphClient.EmailAddress Properties
MSGraphClient.EmailAddress ConstructorsEmailAddress(parser)
Signature
global EmailAddress(JSONParser parser)
MSGraphClient.GetDriveItemPermissionsData
Signature
@JsonAccess(Serializable='always' Deserializable='always')
global class GetDriveItemPermissionsData
MSGraphClient.GetDriveItemPermissionsData Properties
MSGraphClient.GetDriveItemPermissionsData ConstructorsGetDriveItemPermissionsData(parser)
Signature
global GetDriveItemPermissionsData(JSONParser parser)
MSGraphClient.GetEntryFromListResponse
Signature
global class GetEntryFromListResponse
MSGraphClient.GetEntryFromListResponse Properties
MSGraphClient.GetEntryFromListResponse Methods
isError()
Signature
global Boolean isError()
isError(errorCode)
checks if there is an error with a certain error-code present
Signature
global Boolean isError(String errorCode)
MSGraphClient.GetListsFromSiteResponse
Signature
global class GetListsFromSiteResponse
MSGraphClient.GetListsFromSiteResponse Properties
MSGraphClient.GetListsFromSiteResponse Methods
isError()
Signature
global Boolean isError()
isError(errorCode)
checks if there is an error with a certain error-code present
Signature
global Boolean isError(String errorCode)
MSGraphClient.GetSharingPermissionResponse
Signature
@JsonAccess(Serializable='always' Deserializable='always')
global class GetSharingPermissionResponse
MSGraphClient.GetSharingPermissionResponse Properties
MSGraphClient.GetSharingPermissionResponse Methods
isError()
Signature
global Boolean isError()
isError(errorCode)
checks if there is an error with a certain error-code present
Signature
global Boolean isError(String errorCode)
MSGraphClient.GetSharingPermissionsResponse
Signature
@JsonAccess(Serializable='always' Deserializable='always')
global class GetSharingPermissionsResponse
MSGraphClient.GetSharingPermissionsResponse Properties
MSGraphClient.GetSharingPermissionsResponse Methods
isError()
Signature
global Boolean isError()
isError(errorCode)
checks if there is an error with a certain error-code present
Signature
global Boolean isError(String errorCode)
MSGraphClient.GetSiteResponse
Signature
global class GetSiteResponse
MSGraphClient.GetSiteResponse Properties
MSGraphClient.GetSiteResponse Methods
isError()
Signature
global Boolean isError()
isError(errorCode)
checks if there is an error with a certain error-code present
Signature
global Boolean isError(String errorCode)
MSGraphClient.GrantedToIdentitiesV2
Signature
@JsonAccess(Serializable='always' Deserializable='always')
global class GrantedToIdentitiesV2
MSGraphClient.GrantedToIdentitiesV2 Properties
MSGraphClient.GrantedToIdentitiesV2 ConstructorsGrantedToIdentitiesV2(parser)
Signature
global GrantedToIdentitiesV2(JSONParser parser)
MSGraphClient.InvitedUser
Signature
global class InvitedUser
MSGraphClient.InvitedUser Properties
MSGraphClient.InvitedUser ConstructorsInvitedUser(parser)
Signature
global InvitedUser(JSONParser parser)
MSGraphClient.InvitedUserGraphResponse
Signature
global class InvitedUserGraphResponse
MSGraphClient.InvitedUserGraphResponse Properties
MSGraphClient.InvitedUserGraphResponse ConstructorsInvitedUserGraphResponse(parser)
Signature
global InvitedUserGraphResponse(JSONParser parser)
MSGraphClient.InvitedUserMessageInfo
Signature
global class InvitedUserMessageInfo
MSGraphClient.InvitedUserMessageInfo Properties
MSGraphClient.InvitedUserMessageInfo ConstructorsInvitedUserMessageInfo(parser)
Signature
global InvitedUserMessageInfo(JSONParser parser)
MSGraphClient.InviteGuestResponse
Signature
global class InviteGuestResponse
MSGraphClient.InviteGuestResponse Properties
MSGraphClient.InviteGuestResponse Methods
isError()
Signature
global Boolean isError()
isError(errorCode)
checks if there is an error with a certain error-code present
Signature
global Boolean isError(String errorCode)
MSGraphClient.ListItemData
Signature
global class ListItemData
MSGraphClient.ListItemData Properties
MSGraphClient.ListItemData ConstructorsListItemData(parser)
Signature
global ListItemData(JSONParser parser)
MSGraphClient.ListItemDataResponse
Signature
global class ListItemDataResponse
MSGraphClient.ListItemDataResponse Properties
MSGraphClient.ListItemDataResponse Methods
isError()
Signature
global Boolean isError()
isError(errorCode)
checks if there is an error with a certain error-code present
Signature
global Boolean isError(String errorCode)
MSGraphClient.ListMembersResponse
Signature
global class ListMembersResponse
MSGraphClient.ListMembersResponse Properties
MSGraphClient.ListMembersResponse Methods
isError()
Signature
global Boolean isError()
isError(errorCode)
checks if there is an error with a certain error-code present
Signature
global Boolean isError(String errorCode)
MSGraphClient.ListTeamChannelsResponse
Signature
global class ListTeamChannelsResponse
MSGraphClient.ListTeamChannelsResponse Properties
MSGraphClient.ListTeamChannelsResponse Methods
isError()
Signature
global Boolean isError()
isError(errorCode)
checks if there is an error with a certain error-code present
Signature
global Boolean isError(String errorCode)
MSGraphClient.Member
Signature
global class Member
MSGraphClient.Member Properties
Enums
MSGraphClient.Member ConstructorsMember()
Signature
global Member()
Member(parser)
Signature
global Member(JSONParser parser)
MSGraphClient.Member MethodstoJson()
Signature
global String toJson()
MSGraphClient.MSGraphClientStub
Default mock returning only succesful responses. The below will show how the Stub behaves and which values are returned so they can be used in testing and asserting.
Signature
global virtual class MSGraphClientStub implements StubProvider
Example
MSGraphClient.RemoveMemberResponse
Signature
global class RemoveMemberResponse
MSGraphClient.RemoveMemberResponse Properties
MSGraphClient.RemoveMemberResponse Methods
isError()
Signature
global Boolean isError()
isError(errorCode)
checks if there is an error with a certain error-code present
Signature
global Boolean isError(String errorCode)
MSGraphClient.ResponseOrError
Signature
global class ResponseOrError
MSGraphClient.ResponseOrError Properties
MSGraphClient.SharePointList
Signature
global class SharePointList
MSGraphClient.SharePointList Properties
MSGraphClient.SharePointList ConstructorsSharePointList(parser)
Signature
public SharePointList(JSONParser parser)
MSGraphClient.SharingLink
Signature
@JsonAccess(Serializable='always' Deserializable='always')
global class SharingLink
MSGraphClient.SharingLink Properties
MSGraphClient.SharingLink ConstructorsSharingLink(parser)
Signature
global SharingLink(JSONParser parser)
SharingLink()
Signature
return new SharingLink(parser)
MSGraphClient.SharingLink MethodsconsumeObject(parser)
Signature
global void consumeObject(System.JSONParser parser)
parse(jsonString)
Signature
global SharingLink parse(String jsonString)
MSGraphClient.SiteData
Signature
global class SiteData
MSGraphClient.SiteData Properties
MSGraphClient.SiteData ConstructorsSiteData(parser)
Signature
public SiteData(JSONParser parser)
MSGraphClient.TeamData
Signature
global class TeamData
MSGraphClient.TeamData Properties
MSGraphClient.TeamData MethodstoJson()
Signature
global String toJson()
MSGraphClient.TeamDataResponse
Signature
global class TeamDataResponse
MSGraphClient.TeamDataResponse Properties
MSGraphClient.TeamDataResponse Methods
isError()
Signature
global Boolean isError()
isError(errorCode)
checks if there is an error with a certain error-code present
Signature
global Boolean isError(String errorCode)
MSGraphClient.UpdateEntryToListResponse
Signature
global class UpdateEntryToListResponse
MSGraphClient.UpdateEntryToListResponse Properties
MSGraphClient.UpdateEntryToListResponse Methods
isError()
Signature
global Boolean isError()
isError(errorCode)
checks if there is an error with a certain error-code present
Signature
global Boolean isError(String errorCode)
MSGraphClient.UploadSession
Signature
@JsonAccess(Serializable='always' Deserializable='always')
global class UploadSession
MSGraphClient.UploadSession Properties
MSGraphClient.UploadSession ConstructorsUploadSession(parser)
Signature
UploadSession(JSONParser parser)
UploadSession()
Signature
public UploadSession()
MSGraphClient.User
Signature
global class User
MSGraphClient.User Properties
MSGraphClient.User ConstructorsUser(parser)
Signature
global User(JSONParser parser)
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||