次の方法で共有


Constants.TemplateRightView property

The TemplateRightView property retrieves a value that specifies a right to view content.

This property is read-only.

Syntax

Constants.TemplateRightView

Property value

This property returns an integer value (0x1).

Remarks

You can use this property value in the WellKnownRights property on the UserRightsItem object.

Examples

DIM config_manager
DIM admin_role

' *******************************************************************
' Create and initialize a ConfigurationManager object.

SUB InitObject()

  CALL WScript.Echo( "Create ConfigurationManager object...")
  SET config_manager = CreateObject _
    ("Microsoft.RightsManagementServices.Admin.ConfigurationManager")      
  CheckError()
    
  CALL WScript.Echo( "Initialize...")
  admin_role=config_manager.Initialize(false,"localhost",80,"","","")
  CheckError()

END SUB

' *******************************************************************
' Add user rights to the template. 

SUB AddRights()

  DIM templMgr
  DIM template
  DIM userColl
  DIM user
  DIM constant
  DIM CommonRights

  ' Retrieve the Constants object.
  SET constant = config_manager.Constants

  ' Retrieve the RightsTemplatePolicy object.
  SET templMgr = config_manager.RightsTemplatePolicy
  CheckError()

  ' Retrieve the first template in the collection.
  SET template = templMgr.RightsTemplateCollection.Item(0)
  CheckError()

  ' Retrieve the user rights collection.
  SET userColl = template.UserRightsItems

  ' Retrieve and display the user data from the collection.
  FOR EACH user IN userColl
    CALL WScript.Echo("UserId: " & user.UserId)
    CommonRights = user.WellKnownRights

    IF CommonRights = 0 THEN
      CALL WScript.Echo("No rights are defined.")
    ELSE
      IF constant.TemplateRightAllowMacros AND CommonRights THEN
        CALL WScript.Echo("Right: AllowMacros.")
       END IF
      IF constant.TemplateRightEdit AND CommonRights THEN
        CALL WScript.Echo("Right: Edit.")
      END IF
      IF constant.TemplateRightExport AND CommonRights THEN
        CALL WScript.Echo("Right: Export.")
      END IF
      IF constant.TemplateRightExtract AND CommonRights THEN
        CALL WScript.Echo("Right: Extract.")
      END IF
      IF constant.TemplateRightForward AND CommonRights THEN
        CALL WScript.Echo("Right: Forward.")
      END IF
      IF constant.TemplateRightFullControl AND CommonRights THEN
        CALL WScript.Echo("Right: Owner.")
      END IF
      IF constant.TemplateRightPrint AND CommonRights THEN
        CALL WScript.Echo("Right: Print.")
      END IF
      IF constant.TemplateRightReply AND CommonRights THEN
        CALL WScript.Echo("Right: Reply.")
      END IF
      IF constant.TemplateRightReplyAll AND CommonRights THEN
        CALL WScript.Echo("Right: ReplyAll.")
      END IF
      IF constant.TemplateRightSave AND CommonRights THEN
        CALL WScript.Echo("Right: Save.")
      END IF
      IF constant.TemplateRightView AND CommonRights THEN
        CALL WScript.Echo("Right: View.")
      END IF
      IF constant.TemplateRightViewRights AND CommonRights THEN
        CALL WScript.Echo("Right: ViewRights.")
      END IF
    END IF
  NEXT
 
END SUB

' *******************************************************************
' Error checking function.

FUNCTION CheckError()
  CheckError = Err.number
  IF Err.number <> 0 THEN
    CALL WScript.Echo( vbTab & "*****Error Number: " _
                       & Err.number _
                       & " Desc:" _
                       & Err.Description _
                       & "*****")
    WScript.StdErr.Write(Err.Description)
    WScript.Quit( Err.number )
  END IF
END FUNCTION

Requirements

Minimum supported client
None supported
Minimum supported server
Windows Server 2008
Assembly
Microsoft.RightsManagementServices.Admin.dll

See also

Constants