Mar 09 2022 06:56 AM
First, this has been mentioned before and I could only find post that say it isn't possible. However, the documentation doesn't seem to really line up with that.
Accessing shared files and folders - OneDrive API - OneDrive dev center | Microsoft Docs
This page kind of implies it through the naming convention of the shortcut. I also don't see how any app can create a shortcut to any non-onedrive location. With that, I decided to start and see if what I wanted to do was possible...add a shortcut to a document library to a users onedrive folder.
So far I have managed to get a users joined teams then find the appropriate IDs for what the /drive/root/children endpoint wants.
I use /me/joinedTeams to get a list of Teams a user is apart of.
I then pick a group and use /groups/{teamid/groupid}/drive to get an id.
I use the ID from /groups/{teamid/groupid}/drive and do /drives/b!123456abcde/root or /drives/b!123456abcde/root/children to get the parent information.
Then I PSOT to /drive/root/children with the information gathered from previous steps.
However the error I'm getting is "Either 'folder' or 'file' must be provided, but not both." I'm not exactly sure what that means...I'm only providing one id/driveid. Unless for whatever reason a folder is considered both a file or a folder.
More specifically, this is what my request body looks like:
{
"name": "Testing",
"remoteItem": {
"id": "012345678abcdef",
"parentReference": {
"driveId": "b!abcdefghi"
}
}
}
Any help is appreciated. Thanks