This project has moved and is read-only. For the latest updates, please go here.


Add support to load all external users


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)
                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);
                        r => r.UserCollectionPosition,
                        r => r.TotalUserCount,
                        r => r.ExternalUserCollection);

                    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)
                        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
                        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);

                AddLoadingNode(parentNode, loadType);
Closed Feb 1 at 7:46 AM by BdeJager
New release is available as of yesterday. This includes the update.


BdeJager wrote Jan 17 at 7:55 AM

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

BdeJager wrote Feb 1 at 7:45 AM

New release is available as of yesterday. This includes your fix.

wrote Feb 1 at 7:46 AM