The property IsDefaultFolder is always false when retrieving taskfolder list with outlook rest api - outlook-restapi

We are using the outlook-rest api to retrieve a list of taskfolders
GET: https://outlook.office.com/api/v2.0/me/TaskFolders
I tried with a outlook.com and Office 365 account but the property IsDefaultFolder is always false for the default folder.
Can anyone reproduce ? Is this a bug ?
Thanks
See response below
{
"#odata.context": "https://outlook.office.com/api/v2.0/$metadata#Me/TaskFolders",
"value": [{
"#odata.id": "https://outlook.office.com/api/v2.0/Users('xxx')/TaskFolders('ccc')",
"Id": "iii",
"ChangeKey": "ccc",
"Name": "Taken",
"IsDefaultFolder": false,
"ParentGroupKey": "0006f0b7-0000-0000-c000-000000000046"
}],
"#odata.deltaLink": "https://outlook.office.com/api/v2.0/me/TaskFolders/?%24deltatoken=ddd"
}

Related

Users migrated to Office 365 have duplicate calendars called 'calendar' when using Microsoft Graph

We're using an CRM that has switched to using Graph to add events into our users Office 365 calendars. We're getting error messages that there are duplicate calendars called calendar for some users, the users are all users who were migrated from on premise Exchange to Office 365.
Looking in Office 365 via Powershell (get-mailboxfolderstatics -Identity user#contos.com -FolderScope Calendar | ft or in Outlook itself, there is only the one calendar named calendar.
But if I look at the same user via Graph
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('XXXXXXX-762d-47ee-9f82-XXXXXXXXXXX')/calendars",
I see 2 calendars with name Calendar, with slightly different IDs (see last few characters)
Azure support closed the case but the problem remains, how do I get Graph to see only the ONE calendar named calendar, or, how to rename one to something other THAN calendar?
Here's a dump of what I see:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('Bob.Smith%40contoso.com')/calendars",
"value": [
{
"id": "**snipped**_MRaRoNlRUYsQkAAAAABwPAAA=",
"name": "Calendar",
"color": "lightBlue",
"hexColor": "#a6d1f5",
"isDefaultCalendar": true,
"changeKey": "rX0CNBsSo0inAqdEAWRRmQAFRAI=",
"canShare": true,
"canViewPrivateItems": true,
"canEdit": true,
"allowedOnlineMeetingProviders": [
"teamsForBusiness"
],
"defaultOnlineMeetingProvider": "teamsForBusiness",
"isTallyingResponses": true,
"isRemovable": false,
"owner": {
"name": "Bob Smith",
"address": "Bob.Smith#contoso.com"
}
},
{
"id": "**snipped**_MRaRoNlRUYsQkAAApN6VAAAA=",
"name": "Calendar",
"color": "auto",
"hexColor": "",
"isDefaultCalendar": false,
"changeKey": "dt7cZZK/jEWkaDZUVGLEJAAGY8x28w==",
"canShare": true,
"canViewPrivateItems": true,
"canEdit": true,
"allowedOnlineMeetingProviders": [
"teamsForBusiness"
],
"defaultOnlineMeetingProvider": "teamsForBusiness",
"isTallyingResponses": false,
"isRemovable": true,
"owner": {
"name": "Bob Smith",
"address": "Bob.Smith#contoso.com"
}
}
]
}
I have no access to the software creating events, it's a third party SaaS system.
In the short term, one way to do this would be to fetch the calendar by id, then use the query parameters to customize the response using the changeKey. The longer term solution would be to engage your exchange admin to help with setting the right calendar for the users in question, which will eliminate the two calendars returned by graph.

Graph API: Unable to programmatically upload OneDrive item with specific properties (failing for createdBy and lastModifiedDataTime)

I am uploading an item to OneDrive using Graph API. I am also setting the properties of the item after it has been uploaded successfully. I am able to set "lastModifiedDateTime" but am not able to set "createdBy" and "createdDateTime".
"createdBy" is always set to the Azure AD application I have created for OAuth and in OneDrive UI it always shows "modified By" "SharePoint App".
And the "createdDataTime" is always current time (time of upload). Is there any way I can set these properties correctly?
The json I am using to patch the item properties:
{"createdDateTime":"2020-12-28T12:25:39Z",
"lastModifiedDateTime":"2020-12-28T12:25:39Z",
"createdBy":
{
"user":{
"email":"AlexW#vx2.onmicrosoft.com"}
},
"lastModifiedBy":{
"user":{
"email":"AlexW#vx2.onmicrosoft.com"}
},
"fileSystemInfo":{
"lastModifiedDateTime":"2020-12-28T12:25:39Z",
"createdDateTime":"2020-12-28T12:25:39Z"},
"file":{"mimeType":"image/jpeg"}
}
Please find the properties (queries from graph explorer) after the upload and above patch request:
{
"createdDateTime": "2020-12-28T12:28:09Z",
"lastModifiedDateTime": "2020-12-28T12:25:39Z",
"createdBy":
{
"application": {
"displayName": "ConsoleApp"}
},
"fileSystemInfo": {
"createdDateTime": "2020-12-28T12:28:09Z",
"lastModifiedDateTime": "2020-12-28T12:25:39Z"
},
"file": {
"mimeType": "image/jpeg",
"hashes": {
"quickXorHash": "4EQEGnBnLd04VXEmYqGHHIeZ2po="
}
}
}
As you can see user name has been replaced by the Azure AD app name and created by time is the time the upload was done and not the time specified in the patch request.
Please let me know if anyone has any idea about this.
If you refer the below article : https://learn.microsoft.com/en-us/graph/api/resources/driveitem?view=graph-rest-1.0 under the Properties section.
These are read-only fields meaning you will not be able to manually configure the values for the same.
WorkAround :
Having said that this cannot be achieved through Graph API however, you can make use of the Sharepoint API to update the same.
ValidateUpdateListItem()
For modifiying the created by , last modified by and last modified the sample body would be of below :
{ formValues": [
{
"FieldName": "Editor",
"FieldValue": "[{'Key':'i:0#.w|AlexW#vx2.onmicrosoft.com'}]"
},
{
"FieldName": "Author",
"FieldValue": "[{'Key':'i:0#.w|AlexW#vx2.onmicrosoft.com'}]"
},
{
"FieldName": "Created",
"FieldValue": "02/18/2020 11:25 PM"
}
],
"bNewDocumentUpdate": true
}
Request URL :
https://SPOURL/_api/web/Lists/GetbyTitle('Library Name')/items(1)/ValidateUpdateListItem"

Microsoft Graph Search 400 error when searching

I'm getting a 400 error when trying to do a search both through the Graph Explorer and through my own code. Both worked a few weeks ago but have stopped working recently. Another developer has been able to replicate it in their Tenancy, but Microsoft will not provide me support as we are not a Premier Customer.
If I run this query:
https://graph.microsoft.com/v1.0/drives{drive_id}/root/
it succeeds and returns information about the drive.
Following the documentation at https://learn.microsoft.com/en-us/graph/api/driveitem-search?view=graph-rest-1.0&tabs=http a search can be used via
https://graph.microsoft.com/v1.0/drives/{drive-id}/root/search(q='foobar')
But this returns a 400 error with "One of the provided arguments is not acceptable."
However, if I search for items in our entire Tenancy via the group search it succeeds so it doesn't appear to be a permissions error, but is not a viable solution as I need to search a particular drive.
please confirm whether you are still facing the issue. I was not able to reproduce the same from my side.
I ran this query:
https://graph.microsoft.com/v1.0/me/drives/drive-id/root/Search(q='Practices Checker')
And was able to get the desired result as below:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(driveItem)",
"value": [
{
"#odata.type": "#microsoft.graph.driveItem",
"createdDateTime": "2020-12-09T11:55:47Z",
"id": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"lastModifiedDateTime": "2020-11-03T06:51:27Z",
"name": "Practices Checker",
"webUrl": "https://microsoftapc-my.sharepoint.com/personal/ribera_xxxxxxxx_com/Documents/Documents/Practices%20Checker",
"size": 0,
"createdBy": {
"user": {
"email": "ribera#xxxxxxxxxx.com",
"displayName": "Rinki Bera"
}
},
"lastModifiedBy": {
"user": {
"email": "ribera#xxxxxxxxxx.com",
"displayName": "Rinki Bera"
}
},
...
]
}
Thank you.

What does it mean "Property has an invalid value"?

During the creation of a batch of users in Azure AD by using the Graph API version 1.0 I receive the followiing error message:
Property has an invalid value
As you can see, there is not property name in the message, so I can't understand the real problem. What I can say is that those users have no particular conditions among the all others successfully created.
Any ideas?
Update 1:
As people asked, below are the post data. Since there is sensitive data, I have to changed names and som other personal data:
POST https://graph.microsoft.com/v1.0/users
And the JSON payload:
{
"accountEnabled": false,
"country": "BR",
"displayName": "Jane Sagan",
"givenName": "Jane",
"mailNickname": "jane.sagan",
"otherMails": [
"jane.sagan.#gmail.com"
],
"passwordProfile": {
"forceChangePasswordNextSignIn": false,
"password": "J#n3Sa8aN"
},
"surname": "Sagan",
"usageLocation": "BR",
"userPrincipalName": "jane.sagan#university.br",
"userType": "Member"
}
The property "otherMails" doesn't support the format "jane.sagan.#gmail.com".
Username cannot end with '.' in O365. You can have a try (create a user whose username ends with '.') in O365 portal to verify it.

How to use GetChanges API for File Folder changes in MS Sharepoint 2013?

I have added some folder and files to 'Shared Documents' and trying to read get changes response.
Please have a look at my /getchanges request and response below:
POST https://xxxx.sharepoint.com/_api/web/getchanges?$filter=(Time ge datetime'2018-04-03T09:24:17Z')
{"query":{"__metadata":{"type":"SP.ChangeQuery"},"Add":true,"Web":true,"Site":true,"Update": true, "DeleteObject":true, "File":true, "Folder":true, "ContentType":true}}
For the above request I am getting below response:
{
[
"odata.type": "SP.ChangeFile",
"odata.id": "https://xxxx.sharepoint.com/_api/SP.ChangeFile7f33e785-a5dc-424a-bc31-d953171db7b2",
"odata.editLink": "SP.ChangeFile7f33e785-a5dc-424a-bc31-d953171db7b2",
"ChangeToken": {
"StringValue": "1;2;155cd6ac-2fa5-4fc6-8297-10917724fcdf;636583446482830000;79145543"
},
"ChangeType": 1,
"SiteId": "f6aea202-e4c9-4a16-927d-a222975c592e",
"Time": "2018-04-03T09:30:48Z",
"UniqueId": "83746e80-56e7-4b76-9427-6920b0677447",
"WebId": "155cd6ac-2fa5-4fc6-8297-10917724fcdf"
},
{
"odata.type": "SP.ChangeFolder",
"odata.id": "https://xxxxxx.sharepoint.com/_api/SP.ChangeFolder202b82c0-4a3a-4b70-879a-8d41b63ced7f",
"odata.editLink": "SP.ChangeFolder202b82c0-4a3a-4b70-879a-8d41b63ced7f",
"ChangeToken": {
"StringValue": "1;2;155cd6ac-2fa5-4fc6-8297-10917724fcdf;636583446489070000;79145549"
},
"ChangeType": 2,
"SiteId": "f6aea202-e4c9-4a16-927d-a222975c592e",
"Time": "2018-04-03T09:30:49Z",
"UniqueId": "6847b1e9-169b-4d15-9c3c-0b3b1a9848a8",
"WebId": "155cd6ac-2fa5-4fc6-8297-10917724fcdf"
}
]
}
I am facing below issues for getchanges api:
getchanges API not returning changes in response in case of File and Folder. It is returning file and folders updated yesterday.
Same API worked perfectly fine with List, ListItem, etc.
For above response, how can I retrieve which folder or file was added/updated, as I am getting webid and siteid in response
Please suggest?

Resources