Quantcast
Channel: SharePoint Client Browser for SharePoint Online and SharePoint Server (on-prem)
Viewing all articles
Browse latest Browse all 648

Commented Feature: Add support to load all external users [65845]

$
0
0
i fixed this issue, can you please update this method to load all external user

```
public static void LoadExternalUsers(TreeNode parentNode, SPTenantMngt.Office365Tenant tenant, MainForm form, NodeLoadType loadType)
{
try
{
SPClient.ClientContext ctx = GetClientContext(parentNode);

// TODO: Fix issue with pagesize, this needs to be increased and recursive to collect all external users
int position = 0;
bool hasMore = true;
while (hasMore)
{

SPTenantMngt.GetExternalUsersResults results = tenant.GetExternalUsers(position, 50, string.Empty, SPTenantMngt.SortOrder.Ascending);
ctx.Load(results,
r=>r.ExternalUserCollection.Include(k=>k.InvitedBy),
r => r.UserCollectionPosition,
r => r.TotalUserCount,
r => r.ExternalUserCollection);
ctx.ExecuteQuery();

int total = results.TotalUserCount;
int current = 0;

// Add count to parent node
UpdateCountChildNodes(parentNode, total);

// Add external users to parent node


foreach (SPTenantMngt.ExternalUser user in results.ExternalUserCollection)
{

position++;
TreeNode node = AddTreeNode(parentNode, string.Format("{0} ({1})", user.DisplayName, user.InvitedAs), user, Constants.IMAGE_EXTERNAL_USERS, "Represents an external user in Office 365.", form.mnContextItem);

// Update progress
current++;
ItemLoaded(null, new ItemLoadedEventArgs() { TotalItem = total, CurrentItem = current });
}
hasMore = (results.TotalUserCount > position);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, form.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
LogUtil.LogException(ex);

AddLoadingNode(parentNode, loadType);
}
}
```
Comments: ** Comment from web user: BdeJager **

Hi SlimMehrez, thanks for the suggestion. I have made changes to the sources and it will be included in the new release. Regards Bram


Viewing all articles
Browse latest Browse all 648

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>