Document.SyncEvent, événement (System 2007)
Mise à jour : novembre 2007
Se produit lorsque la copie locale d'un document qui fait partie de l'espace de travail d'un document est synchronisée avec la copie sur le serveur.
Espace de noms : Microsoft.Office.Tools.Word
Assembly : Microsoft.Office.Tools.Word.v9.0 (dans Microsoft.Office.Tools.Word.v9.0.dll)
Syntaxe
Public Event SyncEvent As DocumentEvents2_SyncEventHandler
Dim instance As Document
Dim handler As DocumentEvents2_SyncEventHandler
AddHandler instance.SyncEvent, handler
public event DocumentEvents2_SyncEventHandler SyncEvent
Exemples
L'exemple de code suivant détermine si le document fait partie de l'espace de travail d'un document. Si tel est le cas, le code attache un gestionnaire d'événements à l'événement SyncEvent qui affiche un message en cas d'échec de la synchronisation.
Cet exemple illustre une personnalisation au niveau du document.
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.");
}
}
Autorisations
- Confiance totale accordée à l'appelant immédiat. Ce membre ne peut pas être utilisé par du code d'un niveau de confiance partiel. Pour plus d'informations, consultez Utilisation de bibliothèques à partir de code d'un niveau de confiance partiel.