Get Collaboration Name and Email Address from .NET SDK
回答済みHi,
I am using the .NET SDK and am trying to retrieve the collaborations for a folder. How can I get the Name and Login of each collaborator?
I am running the following code:
BoxClient client = await GetBoxClient();
BoxCollection<BoxCollaboration> collaborators = await client.FoldersManager.GetCollaborationsAsync(folderId);
Iterating through the collaborators.Entries, there is an AccessibleBy property. In debug mode, I can see the Name and Login, however I cannot access it directly in my code.
Has anyone had this issue, and if so, how do I fix it?
Thanks.
-
Hi
The object you get in the entries will be a 'BoxEntity' as it could be either a user or a group. It has a 'Type' property you can check and the cast accordingly.
Something like this
collaborators.Entries.ForEach(collaboration =>
{
if(collaboration.AccessibleBy.Type.Equals("user")) {
Console.WriteLine(((BoxUser)collaboration.AccessibleBy).Name + "::" + ((BoxUser)collaboration.AccessibleBy).Login);
}
});Best regards, Peter Christensen, Platform Solutions Engineer, Box
投稿コメントは受け付けていません。
コメント
1件のコメント