Removes users from the list of displayed users and permanently discards any customization of the graphics. Note that a user cannot be removed if he or she owns any elements. 
   Namespace:   Autodesk.Revit.DB  
  Assembly:   RevitAPI  (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0) 
  Since:  2012 
Syntax
| C# | 
|---|
|  | 
| Visual Basic | 
|---|
|  | 
| Visual C++ | 
|---|
|  | 
Parameters
- document
-  Type:  Autodesk.Revit.DB Document  
 The document containing this.
- usersToRemove
-  Type:  System.Collections.Generic ICollection   String  
 The usernames of the users to remove.
- usersActuallyRemoved
-  Type:  System.Collections.Generic ICollection   String   %  
 The users that were successfully removed. Note that you cannot remove users who currently own any elements.
Remarks
 Note that default graphic overrides will be applied to any elements owned by these users if they take ownership of any elements or worksets while they are removed. Note also that the list of removed users will be shared by all users of the central model and will remove all customizations by all users. 
 Examples
 Copy  C#
 Copy  C# public void RemoveAndRestoreUsers(Document doc)
{
    // get or create a WorksharingDisplaySettings current active document
    WorksharingDisplaySettings displaySettings = WorksharingDisplaySettings.GetOrCreateWorksharingDisplaySettings(doc);
    // get all users with GraphicOverrides
    ICollection<String> users = displaySettings.GetAllUsersWithGraphicOverrides();
    // remove the users from the display settings (they will not have graphic overrides anymore)
    ICollection<String> outUserList;
    displaySettings.RemoveUsers(doc, users, out outUserList);
    // show the current list of removed users
    ICollection<String> removedUsers = displaySettings.GetRemovedUsers();
    String message = "Current list of removed users: ";
    if (removedUsers.Count > 0 )
    {
       foreach (String user in removedUsers)
       {
          message += "\n" + user;
       }
    }
    else
    {
        message = "[Empty]";
    }
    TaskDialog.Show("Users Removed", message);
    // restore the previously removed users
    int number = displaySettings.RestoreUsers(outUserList);
    // again, show the current list of removed users
    // it should not contain the users that were restored
    removedUsers = displaySettings.GetRemovedUsers();
    message = "Current list of removed users: ";
    if (removedUsers.Count > 0 )
    {
       foreach (String user in removedUsers)
       {
          message += "\n" + user;
       }
    }
    else
    {
        message = "[Empty]";
    }
    TaskDialog.Show("Removed Users Restored", message);
} Copy  VB.NET
 Copy  VB.NET Public Sub RemoveAndRestoreUsers(doc As Document)
    ' get or create a WorksharingDisplaySettings current active document
    Dim displaySettings As WorksharingDisplaySettings = WorksharingDisplaySettings.GetOrCreateWorksharingDisplaySettings(doc)
    ' get all users with GraphicOverrides
    Dim users As ICollection(Of [String]) = displaySettings.GetAllUsersWithGraphicOverrides()
    ' remove the users from the display settings (they will not have graphic overrides anymore)
    Dim outUserList As ICollection(Of [String]) = Nothing
    displaySettings.RemoveUsers(doc, users, outUserList)
    ' show the current list of removed users
    Dim removedUsers As ICollection(Of [String]) = displaySettings.GetRemovedUsers()
    Dim message As [String] = "Current list of removed users: "
    If removedUsers.Count > 0 Then
        For Each user As [String] In removedUsers
            message += vbLf & user
        Next
    Else
        message = "[Empty]"
    End If
    TaskDialog.Show("Users Removed", message)
    ' restore the previously removed users
    Dim number As Integer = displaySettings.RestoreUsers(outUserList)
    ' again, show the current list of removed users
    ' it should not contain the users that were restored
    removedUsers = displaySettings.GetRemovedUsers()
    message = "Current list of removed users: "
    If removedUsers.Count > 0 Then
        For Each user As [String] In removedUsers
            message += vbLf & user
        Next
    Else
        message = "[Empty]"
    End If
    TaskDialog.Show("Removed Users Restored", message)
End SubExceptions
| Exception | Condition | 
|---|---|
| Autodesk.Revit.Exceptions ArgumentNullException | A non-optional argument was NULL |