You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to download all the files in a SharePoint Document library. Then every day, I'm trying to download the delta of the Document library. So, a sync process.
I'm writing it in C# using the Microsoft Graph SDK.
Questions
The result of the API calls is a bit strange and unclear for me so I'm trying to understand and get confirmation about what the docs are saying.
I'm getting multiple results that are the same (I can't find a difference). The remarks documentation section states: The same item may appear more than once in a delta feed, for various reasons. You should use the last occurrence you see.. Does this mean, that I need to do a Last based on the Id field? So you get 4 of the same items (ids) and then do last and only process that one?
When I ask for an example a page size (top) of 2, I'm getting sometimes 4 results. Why is that? Does it has something to do with the folder structure of a file in the document library?
Why am I getting in every page the root drive item back? I think it has to do with Replays?
I only want to download the files, and not the folder structure. Is it safe to filter the items on Where(x => x.File != null)? What If a folder is deleted? Do I get a delete object for all the files in the folder?
It asks the user for the SharePoint List ID (or uses an environment variable) and an optional delta marker for incremental sync.
Reads credentials from environment variables: It retrieves the necessary Azure AD and SharePoint credentials.
Initializes the Microsoft Graph client: Authenticates and prepares to interact with the SharePoint API.
Finds the correct drive and root folder: Looks up the drive and root folder for the specified SharePoint list.
Fetches items using the delta API: Retrieves the first page of items (or resumes from a delta marker), then continues paging through results if more are available.
Processes each item: For each file or folder, it logs details and (optionally) downloads files that have changed.
Tracks and summarizes results: Counts downloaded and skipped files, and prints a summary including the new delta link for future incremental syncs.
Getting a sample for driveitem delta endpoint just like the sample for users would be nice!
@andrueastman since I saw many related issues about driveitem delta endpoint answered by you. Do you have any idea? Thanks!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to download all the files in a SharePoint Document library. Then every day, I'm trying to download the delta of the Document library. So, a sync process.
I'm writing it in C# using the Microsoft Graph SDK.
I think the best way to do this, is using the Delta endpoints of the Microsoft Graph.
Because we are downloading files from a Document Library, I think we can best use the DriveItem delta endpoint.
Questions
The result of the API calls is a bit strange and unclear for me so I'm trying to understand and get confirmation about what the docs are saying.
The same item may appear more than once in a delta feed, for various reasons. You should use the last occurrence you see.
. Does this mean, that I need to do aLast
based on theId
field? So you get 4 of the same items (ids) and then do last and only process that one?Where(x => x.File != null)
? What If a folder is deleted? Do I get a delete object for all the files in the folder?What I did
The logic of the downloader is doing this:
Getting a sample for driveitem delta endpoint just like the sample for users would be nice!
@andrueastman since I saw many related issues about driveitem delta endpoint answered by you. Do you have any idea? Thanks!
Beta Was this translation helpful? Give feedback.
All reactions