I am trying to update the FileSystemInfo facet for a DriveItem object in OneDrive but I am running into some unexpected issues.
Some background first:
This task is part of Box to OneDrive migration. The users are using a tool for the migration and have noticed once migrated to OneDrive and synced back to their systems the 'created' and 'modified' dates are updated to the date the file was uploaded to OneDrive.
This messes up some of the file management tools they use (multiple files ...same names and now same timestamps) and makes file management difficult.
So we have been asked to update the files with the correct created and modified dates.
From Box developer documentation I see that it has fields to save timestamps for file creation and modify on the client (https://developer.box.com/docs/content-times - specifically the fields content_created_at and content_modified_at).
So the current plan is to use Box API to get the content_created_at and content_modified_at timestamps and then update the filesysteminfo facet of the corresponding file in OneDrive (still trying to workout how to locate that particular file).
End of BackGround Info
On trying this out in the Graph developer I can see that filesysteminfo facet createdDateTime and lastModifiedDateTime are updated as expected. However there are two issues:
The file in my development system does not show an updated Created and modified date (this works fine if I try to update the filename).
I can see that the OneDrive createdDateTime and lastModifiedDateTime also get updated (the ones outside the filesysteminfo facet). This I did not expect.
Could someone guide me on how to get this working and more imp if my understanding is correct
Thanks for all the help
Related
I have an Access DB which is linked to an Excel file. The excel file is linked to a SharePoint List. Whenever a change is made in the SharePoint List, the Excel file reflects the change and this change is also reflected in the Access DB. However, when I open the Excel in Read Only mode, the changes from the SharePoint List are reflected in Excel, but not in Access DB. Is there a way to overcome this (update Access linked table when Excel is opened in Read Only)?
Tried changing IMEX to 0 and 1, but didn't work.
Is it possible to use the microsoft graph api to get the id of a folder within a sharepoint document library? If so, how?
I can see in the documentation that I can get the path of a folder and/or file, and make queries based on this path. But what I would like is to get an id, so if the folder and/or file ever changes name, I can still query that specific folder and/or file. Is this possible?
Specifically, I am creating an internal dashboard for my employees. We have a Folder in a sharepoint document library called "Contacts". Within this "Contacts" folder we have n number of subfolders such as "John Doe," "Jane Doe," etc. If an employee is viewing the information for John Doe within our internal employee dashboard, I'd like to display the any child folders and/or files of John Doe.
Again, all I can find in the graph api documentation is how to query based on the relative path. I'd like to be able to use the API to get an id for any folder and/or file, as well as to return any child objects of any folder using the id (and not the relative path). How can I do this?
Yes it is possible. You should use the below query
https://graph.microsoft.com/v1.0/sites/{siteid}/drives/{document libraryid}/items/{folderid}/children.
If you want to get the folder id use this call
https://graph.microsoft.com/v1.0/sites/{siteid}/drives/{document libraryid}/root/children and get the id of the folder
How do I find a file that was deleted and had a relative path of /foo/baz.txt?
I am using the /v1.0 endpoint and my app requests the Files.ReadWrite.AppFolder scope. I can access /drive/special/appRoot.
Will /drive/special/appRoot:/search(q='baz.txt') find deleted files?
Will /drive/special/appRoot:/foo/baz.txt:/versionsversions for a deleted file?
There is not a lot of examples (or documentation support) for using AppFolder.
I'm afraid this isn't possible today.
When a file is deleted from OneDrive (either via the Web App or the API), it is sent to the Recycle Bin and held for 30 days (assuming the user doesn't manually empty it of course).
At the moment, it isn't possible to access or restore a DriveItem from a dive's Recycle Bin (this has been discussed but I'm unaware of any ETA). The only way to restore an item today is for the user to do so via the OneDrive Web App.
According to your description, I suppose you want to get a file that was deleted in App Folder.
Based on my test, we can use the following API to get the file in App Folder:
/drive/special/approot:/foo/baz.txt:/
However, if we deleted the file, it will return a 404 status code when we use this API.
We can get the file by using this API unless we restore it in the Recycle bin of OneDrive.
I try to search for files on SharePoint Document Library (e.g. the default 'root'). I created a few test-files by uploading them or create new Office files online and made some search-requests, e.g. https://graph.microsoft.com/v1.0/sites/root/drive/root/search(q='{query}') and until yesterday everything worked fine.
Now I started to edit files on SharePoint or created/uploaded new ones and with this edited or new files, I have the problem that I get no result when I search for them. "old" files, I created when I started I find although, as long as I don't edit them.
To get access I registered an App inside the AAD and gave it the needed permissions (
Sites.Read.All, Sites.ReadWrite.All, Files.Read.All, Files.ReadWrite.All
and a direct access to a specific file with https://graph.microsoft.com/v1.0/sites/root/drive/items/{item-id}/ works also well.
Search will read data from indexed data, but crawling and re-indexing of a library need to take some time. So you the code return null for the new files:
https://graph.microsoft.com/v1.0/sites/root/drive/root/search(q='{query}')
The following code get the library data directly but not based on the indexed data, so it works well.
https://graph.microsoft.com/v1.0/sites/root/drive/items/{item-id}/
(I develop in Delphi XE7, edit documents locally in Office 2010 and use SharePoint through a corporate Office365 account.)
I have developed a Delphi program that modifies Word 2010 document properties and even filters and orders them by their properties. The folder where the document was stored is a network folder. The only problem is that this is slow for some colleagues in countries other than the folder location.
I thought that by moving the relevant folder to a Sharepoint server and syncing it with a local folder through OneDrive, I could overcome that issue. Also users could choose between the two interfaces, the Web Browser having access to the Sharepoint server or the Delphi program working on the local folder, changes done in one location being synched by OneDrive with the other location.
I made columns in the Sharepoint library matching the Word properties and initially Sharepoint recognized all properties and made nice lists with them.
The problem is that subsequent changes of the properties are not transferred from one place to another.
If the change is done through the Delphi program in local PC, I have overcome the issue by cheating Sharepoint: instead of simply saving a document, the Delphi program copies and pastes the contents into a new document, where the properties are saved and automatically transferred into Sharepoint columns.
But I have not found a workaround when the change of properties is done through Sharepoint…
Apparently, Sharepoint does not store the column data in the document itself, as custom properties. In fact, after downloading the document it still shows as properties the former values, not the ones showing up in Sharepoint.
Should I give up with my intention of changing properties either locally or through Sharepoint?
It turned out that the Server properties are actually stored in the Office document itself but in a different location. Physically, each type of properties is stored in different files of those that are compressed in a .docx file: custom properties come in the file "docProps/custom.xml", whereas server properties come in "customXml/item3.xml", being referred to with an "internal name" that fills the spaces between words. But anyhow, as noted in some threads here, programmatically server/SharePoint properties can be modified and retrieved through VBA with the collection ContentTypeProperties.