Correctly enter the site_ID using Graph SDK - sharepoint

Regarding this expression to create a folder:
POST /sites/{site-id}/drive/items/{parent-item-id}/children
What is the correct way to enter the {site-id} and the {parent-item-id}, to access a folder (eg:folder_1) in a site (eg: site1)in a domain (eg: mydomain)
I have tried:
POST /sites/mydomain/drive/items/site1/folder_1/children
POST /sites:/mydomain/site1:/drive/items/folder_1/children
and similar, with no success,
Can you help me please?

THanks for the help.
Follow your steps, but In the second step, you say:
"This is the sub folder named "2019" in default Documents library:"
With this, I can acess the shared documents folder inside the site. I don't want to acess that folder. I need to acess another folder that is in the site, but not inside the share documents folder.
Any clue?

Do a get request like this in Graph Explorer with this request:
https://graph.microsoft.com/v1.0/sites/<host>:<server relative url>
Example:
https://graph.microsoft.com/v1.0/sites/zheguo.sharepoint.com:/sites/dev
Then will return site Id
Update if you want to access other library folder in Graph, firstly get drive id with this endpoint:
https://graph.microsoft.com/v1.0/sites/{site-id}/drives
Then access the specific drive folder with this endpoint:
https://graph.microsoft.com/v1.0/sites/{site-id}/drives/{drive-id}
Then for "parent-item-id", it's the specific folder id in document library, you can get with this endpoint:
https://graph.microsoft.com/v1.0/sites/{site-id}/drives/{drive-id}/items/root:
Example:
https://graph.microsoft.com/v1.0/sites/zheguo.sharepoint.com,91a47a59-db5e-4d17-a689-479ee8905533,274459c9-4c96-42bf-9b96-838ffa387aaa/drives/b!WXqkkV7bF02miUee6JBVM8lZRCeWTL9Cm5aDj_o4eqpLdqmLE2R7QosYOZt8Dyao/items/root:/
Then use the endpoint to create folder:
POST /sites/{site-id}/drives/{drive-id}/items/{parent-item-id}/children
Example:
https://graph.microsoft.com/v1.0/sites/zheguo.sharepoint.com,91a47a59-db5e-4d17-a689-479ee8905533,274459c9-4c96-42bf-9b96-838ffa387aaa/drive/items/01WU7SPCC4FNS6KOYTSJFK2MUFRITF5XQL/children
Reference:
Create a new folder in a drive

Related

How to get the file link from a SharePoint/OneDrive Sync location

I am currently using Registry Editor to obtain the cloud OneDrive URL of a local OneDrive folder, through:
HKEY_CURRENT_USER\SOFTWARE\SyncEngines\Providers\OneDrive\ -> UrlNameSpace.
However, for shared folders I cannot seem to obtain the correct path based on the UrlNameSpace property. For example the following below returns:
C: Drive path (MountPoint) - C:\Users\nathan.hurley\MyCompany\John Smith - ShareFolder
(UrlNameSpace) - https://mycompany.sharepoint.com/personal/john_smith_mycompany_com/Documents
Following the example above, if I'm trying to get the cloud OneDrive URL for:
C:\Users\nathan.hurley\MyCompany\John Smith - ShareFolder\Test
Replacing the C: Drive path with the UrlNameSpace will produce the following path:
https://mycompany.sharepoint.com/personal/john_smith_mycompany_com/Documents/Test.
The problem with this online link, is that it doesn't obtain the root synced folder and opening the link will lead to a 404 page error. The correct URL should be the following:
https://mycompany.sharepoint.com/personal/john_smith_mycompany_com/Documents/ShareFolder/Test
Again, I've noticed this issue only occurs with shared folders and within the Registry Editor, these folders also include an additional property called IsFolderScope. Is there an efficient way to determine which folders are Shared Folders other than checking the IsFolderScope property? Also, are shared folders the only folders that include this property?
Reference: https://tdalon.blogspot.com/2020/12/get-url-from-sync.html

How to get multiple files using GetBobContent and add as attachment to Email in Azure Logic app?

Hi I am working in Azure Logic app. I am trying to get multiple files from azure data Lake gen v2 and attach these multiple files in an email. As a first step I have added http request and I am giving required information along with file path. It works fine for one file. but I am trying to input folder path and inside that folder, all the files I want to get and attach in email.
Logic app Flow Diagram
Added sample screenshot for attachment
tried to add attchment
In the above diagram, Get blob content step which works fine for one file but I am finding difficult to attach multiple files in email. Can some one help me to figure out the solution. Any help would be appreciated. Thank you
You can use List blobs action to list all blobs in the folder you want:
Then you can define a variable to append the attachments array.
Use For Each to loop the blobs from List Blobs action. Within For Each you can use Get blob content to get blob content, and then use Append to array variable to append attachments.
The expressions of Path, DisplayName and File Content are as follows:
Path : items('For_each')?['Path']
DisplayName : items('For_each')?['DisplayName']
File Content : body('Get_blob_content')
Finally, please fill in the attachment in the email:
==========================update===================
If you send an email with 400 response, please use expression in Append to array variable as below:
base64(body('Get_blob_content'))

Is there any rest end point where I can find if the id I have is a file or a folder for onedrive/sharepoint?

I have an id(fdxxxf8-6xxb-4xx0-8xx9-9xxx8) which i got from one of the API response. Is there anyway to figure it out if the id is of a file or a folder?
I need to call to different API based on if it is a folder or a file
We can use the OneDrive API like below, if the Response data contains file property, the id is of a file, if the Response data contains folder property, the id is of a folder.
/me/drive/items/{item-id}?$select=file,folder
Reference: Get a DriveItem resource

How to rename project with Google Apps Script API

Is there any way to rename Google Apps Script project using API? I can't find any appropriate method for this.
UPD: I want to change Project's name like
You can modify the project name of the container-bound script type using Drive API. In order to use this, please retrieve the project ID, retrieve access token and enable Drive API.
End point :
PATCH https://www.googleapis.com/drive/v3/files/### project ID ###
Request body :
{
"name": "### Modified name ###"
}
Note :
In Google Drive, the project name is the same to the filename of the project.
Unfortunately, in the current stage, the project ID cannot be retrieved from Spreadsheet. But by the recent update, the file ID of Spreadsheet got to be able to be retrieved from the project of the container-bound script type. I would like to expect that the project ID will be retrieved from Spreadsheet in the future.
Reference :
Files: update

Docusign Template List Folder by name not working

All,
I have read and coded the following listed in documentation
https://docs.docusign.com/esign/restapi/Templates/Templates/list/
In above the following is shown
folder string
The query value can be a folder name or folder ID. The response will only return templates in the specified folder.
when I use folder id it's found but nothing is returned when I use folder name. I have verified that folder name matches
Also tried to use a "[{"name": "GTP"}]" but that will result in a error
HELP!
C#
templatesApi.ListTemplates(AccountId, new TemplatesApi.ListTemplatesOptions { sharedByMe = "true", folder = "GTP" }); // no results
templatesApi.ListTemplates(AccountId, new TemplatesApi.ListTemplatesOptions { sharedByMe = "true", folder = "bba1e719-1f38-4a1a-a8cc-03c4960de336" }); // works
It worked fine for me when I am using below API call and testing using Postman,
GET /restapi/v2/accounts/<accountId>/templates?folder=FolderName
As Amit says, the API call can use the name of a folder, but only if the folder is not a shared folder. To list the contents of a shared folder you need to use the folderId.
I have filed DocuSign internal bug report EC-1163. Please ask DocuSign customer service or your DocuSign technical contact to add your organization's information to the bug report. That will help increase its priority.
Workaround: Use the Shared Folder's id for the search.

Resources