infoRouter Document Management System - Web Services API Documentation
SetFolderRules
Sets the rules of the specified folder.
Syntax
[Visual Basic]
Public Function SetFolderRules(ByVal AuthenticationTicket As String, _
ByVal Path As String, _
ByVal xmlRules As System.Xml.XmlNode, _
ByVal ApplyToTree As Boolean) As System.Xml.XmlDocument
Parameters

AuthenticationTicket

infoRouter Authentication Ticket

PWD

infoRouter Login user password

Path

The Folder Path that specified rules to be applied

xmlRules

The xml structure of the rules.To Details of this parameter see the remarks section.

ApplyToTree

To apply the specified rules to sub folders set this parameter to True


Return Value
returns xml fragment.
<response success="true" error="">
if success = "true", the Rules has been successfully applied.
if success = "false", the error attribute returns the error description.
Remarks
The Rules XML fragment should be as described below.
The Rule item that is not specified it the xml structure will not be updated.
For the AllowableFileTypes set value attribute to comma delimeted file extensions or set value to "*" for allowing all file types.

<Rules>
<Rule Name="AllowableFileTypes" Value="BMP,DOC,JPG,XLS" />
<Rule Name="Checkins" Value="disallows" />
<Rule Name="Checkouts" Value="disallows" />
<Rule Name="DocumentDeletes" Value="disallows" />
<Rule Name="FolderDeletes" Value="disallows" />
<Rule Name="NewDocuments" Value="disallows" />
<Rule Name="NewFolders" Value="disallows" />
<Rule Name="ClassifiedDocuments" Value="allows" />
</Rules>
Example
Public Sub SetFolderRules()
Const IR_AuthenticationTicket As String = "sid-xxxxxxxxxxxxxx"

Const IR_FolderPath As String = "/public"
Const IRFolderRule_AllowableFileTypes As String = "doc,xls,jpg,bmp" '"*" for all type of documents
Const IRFolderRule_AllowCheckIns As Boolean = True
Const IRFolderRule_AllowCheckouts As Boolean = False
Const IRFolderRule_AllowDocumentDeletes As Boolean = False
Const IRFolderRule_AllowFolderDeletes As Boolean = False
Const IRFolderRule_AllowNewDocuments As Boolean = False
Const IRFolderRule_AllowNewFolders As Boolean = False
Const IRFolderRule_AllowClassifiedDocuments As Boolean = True
Const ApplytoTree As Boolean = False 'apply to sub folders or not

Dim IR_Obj As InfoRouter.srv
Dim xmldoc As System.Xml.XmlDocument

Try

xmldoc = New System.Xml.XmlDocument
xmldoc.LoadXml("<Rules/>")

Dim xmlelem As System.Xml.XmlElement

'Allowable file extensions
xmlelem = xmldoc.CreateElement("Rule")
xmlelem.SetAttribute("Name", "AllowableFileTypes")
xmlelem.SetAttribute("Value", IRFolderRule_AllowableFileTypes)
xmldoc.DocumentElement.AppendChild(xmlelem)

'CheckIns - allows, disallows
xmlelem = xmldoc.CreateElement("Rule")
xmlelem.SetAttribute("Name", "Checkins")
xmlelem.SetAttribute("Value", IIf(IRFolderRule_AllowCheckIns, "allows", "disallows"))
xmldoc.DocumentElement.AppendChild(xmlelem)

'Checkouts - allows, disallows
xmlelem = xmldoc.CreateElement("Rule")
xmlelem.SetAttribute("Name", "Checkouts")
xmlelem.SetAttribute("Value", IIf(IRFolderRule_AllowCheckouts, "allows", "disallows"))
xmldoc.DocumentElement.AppendChild(xmlelem)

'DocumentDeletes - allows, disallows
xmlelem = xmldoc.CreateElement("Rule")
xmlelem.SetAttribute("Name", "DocumentDeletes")
xmlelem.SetAttribute("Value", IIf(IRFolderRule_AllowDocumentDeletes, "allows", "disallows"))
xmldoc.DocumentElement.AppendChild(xmlelem)

'FolderDeletes - allows, disallows
xmlelem = xmldoc.CreateElement("Rule")
xmlelem.SetAttribute("Name", "FolderDeletes")
xmlelem.SetAttribute("Value", IIf(IRFolderRule_AllowFolderDeletes, "allows", "disallows"))
xmldoc.DocumentElement.AppendChild(xmlelem)

'NewDocuments - allows, disallows
xmlelem = xmldoc.CreateElement("Rule")
xmlelem.SetAttribute("Name", "NewDocuments")
xmlelem.SetAttribute("Value", IIf(IRFolderRule_AllowNewDocuments, "allows", "disallows"))
xmldoc.DocumentElement.AppendChild(xmlelem)

'NewFolders - allows, disallows
xmlelem = xmldoc.CreateElement("Rule")
xmlelem.SetAttribute("Name", "NewFolders")
xmlelem.SetAttribute("Value", IIf(IRFolderRule_AllowNewFolders, "allows", "disallows"))
xmldoc.DocumentElement.AppendChild(xmlelem)

'ClassifiedDocuments - allows, disallows
xmlelem = xmldoc.CreateElement("Rule")
xmlelem.SetAttribute("Name", "ClassifiedDocuments")
xmlelem.SetAttribute("Value", IIf(IRFolderRule_AllowClassifiedDocuments, "allows", "disallows"))
xmldoc.DocumentElement.AppendChild(xmlelem)

Dim xmlResponse As System.Xml.XmlElement
IR_Obj = New InfoRouter.srv
xmlResponse = IR_Obj.SetFolderRules(IRAuthenticationTicket, IR_FolderPath, xmldoc.DocumentElement, ApplytoTree)
If xmlResponse.GetAttribute("success") = "true" Then
Console.WriteLine("Rules applied successfully")
Else
Console.WriteLine("Rules cannot be applied :" & xmlResponse.GetAttribute("error"))
End If
xmlResponse = Nothing

Catch ex As Exception
Console.WriteLine("error:" & ex.Message)
Finally
xmldoc = Nothing
IR_Obj = Nothing
End Try

End Sub
See Also
GetFolderRules - SetAccessList
Syntax based on infoRouter Document Management System Web Services API Version 7.0
Copyright() 1998-2003 Active Innovations, Inc.
infoRouter Document Management System