Düzenle

Aracılığıyla paylaş


SensitivityLabel.LabelChanged event (Office)

Raised when a Label is changed on the document.

Syntax

expression.LabelChanged (OldLabelInfo, NewLabelInfo, HResult, Context)

expression A variable that represents a SensitivityLabel object.

Remarks

The LabelChanged event is raised after the SetLabel is called to indicate the success of LabelInfo set operation. If the HResult contains value other than 0, it indicates LabelInfo set operation failure. The context if passed during SetLabel is returned here.

Parameters

Name Required/Optional Data type Description
OldLabelInfo Required LabelInfo Previous label information that existed on the document.
NewLabelInfo Required LabelInfo New label information that was applied on the document.
HResult Required Long An integer representing the error code.
Context Required Object The context object that was set with SetLabel call.

Example

The following example shows the usage of GetLabel method.

Public WithEvents sensitivityLabel As SensitivityLabel

Private Sub sensitivityLabel_LabelChanged(ByVal OldLabelInfo As Office.LabelInfo, ByVal NewLabelInfo As Office.LabelInfo, ByVal HResult As Long, ByVal Context As Object)

 MsgBox "Event raised: " + NewLabelInfo.LabelId

End Sub

Sub SetLabelInfo()

 Set sensitivityLabel = ActiveDocument.SensitivityLabel
 Dim myLabelInfo As Office.LabelInfo
 Set myLabelInfo = sensitivityLabel.CreateLabelInfo()

 With myLabelInfo
  .AssignmentMethod = MsoAssignmentMethod.PRIVILEGED
  .Justification = "Some justification needed only if downgrading label."
  .LabelId = "9203368f-916c-4d59-8292-9f1c6a1e8f39"
  .LabelName = "MyLabelName"
  .SiteId = "6c15903a-880e-4e17-818a-6cb4f7935615"
 End With

 sensitivityLabel.SetLabel myLabelInfo, myLabelInfo

End Sub

See also

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.