DocumentBase.SyncEvent Event
Occurs when the local copy of a document that is part of a Document Workspace is synchronized with the copy on the server.
Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)
Syntax
'Declaration
Public Event SyncEvent As DocumentEvents2_SyncEventHandler
public event DocumentEvents2_SyncEventHandler SyncEvent
Examples
The following code example determines whether the document is part of a Document Workspace. If it is, the code attaches an event handler to the SyncEvent event that displays a message when the synchronization fails. To use this example, run it from the ThisDocument class in a document-level project.
Private Sub DocumentSyncAndSyncEvent()
If Me.Sync.Status = Office.MsoSyncStatusType.msoSyncStatusNoSharedWorkspace Then
MessageBox.Show("The document is not part of a " & "shared document workspace.")
Return
End If
AddHandler Me.SyncEvent, AddressOf ThisDocument_SyncEvent
End Sub
Private Sub ThisDocument_SyncEvent(ByVal SyncEventType As Office.MsoSyncEventType)
If SyncEventType = Office.MsoSyncEventType.msoSyncEventDownloadFailed _
OrElse SyncEventType = Office.MsoSyncEventType.msoSyncEventUploadFailed Then
MessageBox.Show("Document synchronization failed. " & _
"Please contact your administrator.")
End If
End Sub
private void DocumentSyncAndSyncEvent()
{
if (this.Sync.Status ==
Office.MsoSyncStatusType.msoSyncStatusNoSharedWorkspace)
{
MessageBox.Show("The document is not part of a " +
"shared document workspace.");
return;
}
this.SyncEvent +=
new Word.DocumentEvents2_SyncEventHandler(
ThisDocument_SyncEvent);
}
void ThisDocument_SyncEvent(Office.MsoSyncEventType SyncEventType)
{
if (SyncEventType ==
Office.MsoSyncEventType.msoSyncEventDownloadFailed ||
SyncEventType ==
Office.MsoSyncEventType.msoSyncEventUploadFailed)
{
MessageBox.Show("Document synchronization failed. " +
"Please contact your administrator.");
}
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.