WorksharingDisplaySettingsRemoveUsers Method |
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.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntaxpublic void RemoveUsers(
Document document,
ICollection<string> usersToRemove,
out ICollection<string> usersActuallyRemoved
)
Public Sub RemoveUsers (
document As Document,
usersToRemove As ICollection(Of String),
<OutAttribute> ByRef usersActuallyRemoved As ICollection(Of String)
)
public:
void RemoveUsers(
Document^ document,
ICollection<String^>^ usersToRemove,
[OutAttribute] ICollection<String^>^% usersActuallyRemoved
)
member RemoveUsers :
document : Document *
usersToRemove : ICollection<string> *
usersActuallyRemoved : ICollection<string> byref -> unit
Parameters
- document Document
-
The document containing this.
- usersToRemove ICollectionString
-
The usernames of the users to remove.
- usersActuallyRemoved ICollectionString
-
The users that were successfully removed. Note that you cannot remove
users who currently own any elements.
Exceptions
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.
Examplepublic void RemoveAndRestoreUsers(Document doc)
{
WorksharingDisplaySettings displaySettings = WorksharingDisplaySettings.GetOrCreateWorksharingDisplaySettings(doc);
ICollection<String> users = displaySettings.GetAllUsersWithGraphicOverrides();
ICollection<String> outUserList;
displaySettings.RemoveUsers(doc, users, out outUserList);
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);
int number = displaySettings.RestoreUsers(outUserList);
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);
}
Public Sub RemoveAndRestoreUsers(doc As Document)
Dim displaySettings As WorksharingDisplaySettings = WorksharingDisplaySettings.GetOrCreateWorksharingDisplaySettings(doc)
Dim users As ICollection(Of [String]) = displaySettings.GetAllUsersWithGraphicOverrides()
Dim outUserList As ICollection(Of [String]) = New List(Of String)
displaySettings.RemoveUsers(doc, users, outUserList)
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)
Dim number As Integer = displaySettings.RestoreUsers(outUserList)
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 Sub
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also