
I am using CRM Dynamics 365 online,
When I am trying to use the RetrieveEntityChangesRequest in C# it works well for all entities except attachment and activityMimeAttachment (attachment that is attach to mail or other activities), in those entities i am getting the following message:
You don't have sufficient privileges to access attachment entity
The problem is that there is no option to add privileges to that entities at all, more over I created security role with all privileges in organization level still getting the same error, but when I am trying to do the same action with system admin security role its working.
Someone as a clue?
Hi oriel,
I believe this 'attachment' and 'activityMimeAttachment' should be hard coded in Admin Security Role. You could copy the system admin role and add your customizations to create a new role for Development. While if you want the RCA for this , I would suggest you to raise a ticket for this question since D365 BE Team could help figure out these two entities access privilege from Azure DB which is much close to by-design question.
In addition , I add a digression that setting attachmentId is not allowed while creating Attachments. Following sample code can be used to create attachment while passing activitymimeattachmentid.
Entity _sampleAttachment = new Entity(ActivityMimeAttachment.EntityLogicalName);
_sampleAttachment.Attributes.Add("activitymimeattachmentid", new Guid("586f7952-e065-e811-810a-3863bb2e34e0"));
_sampleAttachment.Attributes.Add("objectid", new EntityReference(Email.EntityLogicalName, emailId));
_sampleAttachment.Attributes.Add("objecttypecode", Email.EntityLogicalName);
_sampleAttachment.Attributes.Add("body", System.Convert.ToBase64String(new ASCIIEncoding().GetBytes("Example Attachment 12")));
_sampleAttachment.Attributes.Add("subject", String.Format("Sample Attachment adding new guid {0}", currentTry.ToString()));
_sampleAttachment.Attributes.Add("filename", String.Format("ExampleAttachment{0}.txt", currentTry.ToString()));
var _emailAttachmentId = proxy.Create(_sampleAttachment);
Regards
Johnny