ServerDocument.DeploymentManifestUrl 屬性 (2007 系統)

更新:2007 年 11 月

取得或設定與文件關聯的 Visual Studio Tools for Office 自訂的部署資訊清單 URL。

命名空間:  Microsoft.VisualStudio.Tools.Applications
組件:  Microsoft.VisualStudio.Tools.Applications.ServerDocument.v9.0 (在 Microsoft.VisualStudio.Tools.Applications.ServerDocument.v9.0.dll 中)

語法

Public Property DeploymentManifestUrl As Uri

Dim instance As ServerDocument
Dim value As Uri

value = instance.DeploymentManifestUrl

instance.DeploymentManifestUrl = value
public Uri DeploymentManifestUrl { get; set; }

屬性值

型別:System.Uri

URL,指定與文件關聯之自訂的部署資訊清單名稱和位置。

備註

如果您將自訂的部署資訊清單移至不同的位置,而且要文件從新位置尋找自訂更新,請將這個屬性設定為新的 URL。如果設定這個屬性,URL 必須指向已經與文件關聯之自訂的部署資訊清單。

您無法使用這個屬性將新自訂與文件產生關聯。若要將自訂加入至未自訂的文件,請使用 AddCustomization 方法。若要將不同的自訂加入至已自訂的文件,請先使用 RemoveCustomization 方法移除目前的自訂,再使用 AddCustomization 方法。

範例

在下列程式碼範例中,會使用 ServerDocument(String) 建構函式建立新的 ServerDocument 物件,以載入指定的文件。範例接著會顯示附加至文件之 Visual Studio Tools for Office 自訂的部署資訊清單 URL。

這個範例要求在您的程式碼檔案頂端要有 Microsoft.VisualStudio.Tools.Applications.ServerDocument.v9.0.dll 和 Microsoft.VisualStudio.Tools.Applications.Runtime.v9.0.dll 組件的參考,以及 Microsoft.VisualStudio.Tools.ApplicationsMicrosoft.VisualStudio.Tools.Applications.Runtime 命名空間的 Imports (適用於 Visual Basic) 或 using (適用於 C#) 陳述式。

Private Sub CreateServerDocumentFromPath(ByVal documentPath As String)
    Dim runtimeVersion As Integer = 0
    Dim serverDocument1 As ServerDocument = Nothing

    Try
        runtimeVersion = ServerDocument.GetCustomizationVersion(documentPath)
        If runtimeVersion = 3 Then
            serverDocument1 = New ServerDocument(documentPath)
            MessageBox.Show("The URL of the deployment manifest is: " & vbLf & _
                serverDocument1.DeploymentManifestUrl.ToString())
        End If

    Catch ex As System.IO.FileNotFoundException
        System.Windows.Forms.MessageBox.Show("The specified document does not exist.")
    Catch ex As UnknownCustomizationFileException
        System.Windows.Forms.MessageBox.Show("The specified document has a file " & _
            "extension that is not supported by Visual Studio Tools for Office.")
    Finally
        If Not (serverDocument1 Is Nothing) Then
            serverDocument1.Close()
        End If
    End Try
End Sub
private void CreateServerDocumentFromPath(string documentPath)
{
    int runtimeVersion = 0;
    ServerDocument serverDocument1 = null;

    try
    {
        runtimeVersion = ServerDocument.GetCustomizationVersion(documentPath);
        if (runtimeVersion == 3)
        {
            serverDocument1 = new ServerDocument(documentPath);
            MessageBox.Show("The URL of the deployment manifest is: \n" +
                serverDocument1.DeploymentManifestUrl.ToString());
        }
    }
    catch (System.IO.FileNotFoundException)
    {
        System.Windows.Forms.MessageBox.Show("The specified document does not exist.");
    }
    catch (UnknownCustomizationFileException)
    {
        System.Windows.Forms.MessageBox.Show("The specified document has a file " +
            "extension that is not supported by Visual Studio Tools for Office.");
    }
    finally
    {
        if (serverDocument1 != null)
            serverDocument1.Close();
    }
}

使用權限

請參閱

參考

ServerDocument 類別

ServerDocument 成員

Microsoft.VisualStudio.Tools.Applications 命名空間