Partager via


ServerInfo Class

Provides information about the SharePoint Foundation server where a form is located.

Inheritance Hierarchy

System.Object
  Microsoft.Office.InfoPath.ServerInfo

Namespace:  Microsoft.Office.InfoPath
Assembly:  Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)

Syntax

'Declaration
Public MustInherit Class ServerInfo
'Usage
Dim instance As ServerInfo
public abstract class ServerInfo

Remarks

If the form template was published to a SharePoint Foundation server, the members of the ServerInfo class can be used to determine information about where the form is published, such as the URL of the document library where the form is located. To access the ServerInfo object associated with the current form, use the ServerInfo property of the XmlForm class.

In a managed code form template created using the object model provided by the members of the Microsoft.Office.InfoPath namespace, you can use the this (C#) or Me (Visual Basic) keyword in your form code to access the members of the XmlForm class directly (without requiring an object variable that establishes a reference to the XmlForm class).

For example, the following code example uses the this or Me keyword to access the ServerInfo object associated with the current form, and then uses the SharePointListUrl property to create a string variable that contains the URL of the document library where the form is located.

string strListUrl = this.ServerInfo.SharePointListUrl.OriginalString;
Dim strListUrl As String = Me.ServerInfo.SharePointListUrl.OriginalString

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

ServerInfo Members

Microsoft.Office.InfoPath Namespace