question

SenthilKumar-1302 avatar image
0 Votes"
SenthilKumar-1302 asked RaytheonXie-MSFT edited

C# Programmatically simulate SharePoint Online "Specific People" for an external user and track their activity

I have a requirement to programmatically simulate the "Specific people" functionality using CSOM or PnP. (Please refer to the screenshot for the Specific people option).

I tried the following programmatically however it generates only Anonymous Link which does not help in my situation as the user is always tracked as "Guest User".

My requirement is to send unique links to each external user identified by email id and when there is a change made to the document by the external user, I need to track them.

Code used by me is,

     public void ShareTheDocument(ClientContext context, List<string> emails, string absoluteDocUrl)
     {

             var userRoles = new List<UserRoleAssignment>();
             foreach (var user in emails)
             {
                 UserRoleAssignment role = new UserRoleAssignment();
                 role.UserId = user;
                 role.Role = Role.Edit;
                 userRoles.Add(role);
             }
               
             IList<UserSharingResult> userSharingResults =  DocumentSharingManager.UpdateDocumentSharingInfo(context, absoluteDocUrl, userRoles, false, true, true, "New Document - 1", true, false);
             context.ExecuteQuery();

     }

119592-image.png



PLEASE HELP. Thank you.

office-sharepoint-onlinesharepoint-dev
image.png (56.7 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

RaytheonXie-MSFT avatar image
0 Votes"
RaytheonXie-MSFT answered RaytheonXie-MSFT commented

Hi @SenthilKumar-1302 ,
Currently there is no such way to meet your requirement.
I have tested that the file can only be shared with existing users,but can't be shared with external users not exist.


If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @SenthilKumar-1302 ,
would you please provide us with an update on the status of your issue?

0 Votes 0 ·