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 am trying to update permissions on a calendar folder. The recommended process is to bind to the folder after explicitly specifying that permissions be included in the PropertySet, modify the permission set, and then call FolderUpdate.
There are typically three permissions by default on every calendar: Default (none), Anonymous (none), and "any authenticated user" (read free/busy values only). When calendar permissions are retrieved, that last one is included, and its UserId value is empty -- no StandardUser, sID, or PrimarySmtpAddress. Its permissionLevel is 11, meaning custom.
That causes all updates to fail, because validation for UserId requires one of those three values. The specific error (from UserId.ts) is: "The UserId in the folder permission at index 0 is invalid. The StandardUser, PrimarySmtpAddress, or SID property must be set."
If you remove that "all authenticated users" permission before submitting, the validation error is avoided. However, the operation still fails on the server, because the <t:Updates></t:Updates> element is empty. It does not appear that changes to the Permissions property are reflected in the XML sent to the server. (This would be a bad thing to do in production in any case, since you'd be removing the ability for people to see free/busy info for their colleagues.)
Here is the code I'm using:
letews=require('ews-javascript-api');varexch=newews.ExchangeService(ews.ExchangeVersion.Exchange2013);exch.Credentials=newews.ExchangeCredentials("foo@example.com","foopw");exch.Url=newews.Uri("https://example.com/Ews/Exchange.asmx");constcalendarFolderId=newews.FolderId(ews.WellKnownFolderName.Calendar,newews.Mailbox("foo@example.com"))constpropertySet=newews.PropertySet(ews.BasePropertySet.FirstClassProperties,ews.FolderSchema.Permissions)ews.CalendarFolder.Bind(exch,calendarFolderId,propertySet).then((calendarFolder)=>{// allow user "bar" to see calendar of user "foo"constuserId=newews.UserId("bar@example.com")constpermission=newews.FolderPermission(userId,ews.FolderPermissionLevel.Reviewer)calendarFolder.Permissions.Add(permission)exch.UpdateFolder(calendarFolder).then((response)=>{console.log('Succeeded!')},err=>{console.log(err)})})
Any ideas on how to get around this?
Thanks!
The text was updated successfully, but these errors were encountered:
I have to work on series of files (which has similar issues). if you want to try fix this one only, rename LoadFromXmlJsObject method to CreateFromXmlJsObjectCollection in FolderPermissionCollection.js file.
I am trying to update permissions on a calendar folder. The recommended process is to bind to the folder after explicitly specifying that permissions be included in the
PropertySet
, modify the permission set, and then callFolderUpdate
.There are typically three permissions by default on every calendar: Default (none), Anonymous (none), and "any authenticated user" (read free/busy values only). When calendar permissions are retrieved, that last one is included, and its
UserId
value is empty -- noStandardUser
,sID
, orPrimarySmtpAddress
. Its permissionLevel is 11, meaning custom.That causes all updates to fail, because validation for
UserId
requires one of those three values. The specific error (from UserId.ts) is: "The UserId in the folder permission at index 0 is invalid. The StandardUser, PrimarySmtpAddress, or SID property must be set."If you remove that "all authenticated users" permission before submitting, the validation error is avoided. However, the operation still fails on the server, because the
<t:Updates></t:Updates>
element is empty. It does not appear that changes to thePermissions
property are reflected in the XML sent to the server. (This would be a bad thing to do in production in any case, since you'd be removing the ability for people to see free/busy info for their colleagues.)Here is the code I'm using:
Any ideas on how to get around this?
Thanks!
The text was updated successfully, but these errors were encountered: