This documentation is archived and is not being maintained.

Workbook.SharedWorkspace Property

Gets a SharedWorkspace that represents the Document Workspace in which the workbook is located.

Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in microsoft.office.tools.excel.dll)

public virtual SharedWorkspace SharedWorkspace { get; }

Property Value

A SharedWorkspace that represents the Document Workspace in which the workbook is located.

The following code example uses the SharedWorkspace property to determine whether the current workbook is part of a Document Workspace. If the workbook is part of a Document Workspace, then the example uses the Sync property to display the user who last changed the document.

private void DisplayLastChangeBy()
{
    if (this.SharedWorkspace.Connected)
    {
        MessageBox.Show("Last changed by: " +
            this.Sync.WorkspaceLastChangedBy);
    }
    else
    {
        MessageBox.Show("The current document is not connected " +
            "to a shared workspace.");
    }
}

Show: