共用方式為


WssInterop.ReadProjectSiteBaseUrls 方法

讀取 web 應用程式 Guid 和基底網站可用來建立project sites的 Url。

命名空間:  WebSvcWssInterop
組件:  ProjectServerServices (在 ProjectServerServices.dll 中)

語法

'宣告
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/WssInterop/ReadProjectSiteBaseUrls", RequestNamespace := "https://schemas.microsoft.com/office/project/server/webservices/WssInterop/",  _
    ResponseNamespace := "https://schemas.microsoft.com/office/project/server/webservices/WssInterop/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function ReadProjectSiteBaseUrls As WssServersDataSet
'用途
Dim instance As WssInterop
Dim returnValue As WssServersDataSet

returnValue = instance.ReadProjectSiteBaseUrls()
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/WssInterop/ReadProjectSiteBaseUrls", RequestNamespace = "https://schemas.microsoft.com/office/project/server/webservices/WssInterop/", 
    ResponseNamespace = "https://schemas.microsoft.com/office/project/server/webservices/WssInterop/", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public WssServersDataSet ReadProjectSiteBaseUrls()

傳回值

類型:WebSvcWssInterop.WssServersDataSet
列出設定為允許的project sites建立的 web 應用程式。

備註

WssServersDataTable包含每個 web 應用程式設定為允許的project sites建立一列。將資料包含只WSTS_SERVER_UID屬性和WSS_SERVER_URL屬性。

ReadProjectSiteBaseUrls方法會填入Web 應用程式] 下拉式清單, Project Web App (https://ServerName/ProjectServerName/_layouts/pwa/Admin/UpdateSites.aspx) 中 [大量更新專案網站] 頁面中。ReadProjectSiteBaseUrls方法通常用來取得UpdateProjectSitePaths方法的資料。

Project Server 權限

權限

描述

ManageWindowsSharePointServices

可讓使用者管理project site。通用權限。

範例

下列範例會使用ReadProjectSiteBaseUrls讀取 web 應用程式的 Guid,並依據網站的 Url,然後再寫入至 XML 檔案的WssServersDataSet內容。

The example uses the SvcWssInterop namespace in the ProjectServerServices.dll proxy assembly. The ConfigClientEndpoints method uses an app.config file for setting the WCF binding, behavior, and endpoint. For information about creating a PSI proxy assembly and an app.config file, see Prerequisites for WCF-Based Code Samples.

using System;
using System.IO;
using System.ServiceModel;
using System.Text;

namespace Microsoft.SDK.Project.Samples.ProjectSitePaths
{
    class Program
    {
        private const string ENDPOINT = "basicHttp_WssInterop";
        private const string OUTPUT_DIRECTORY = @"C:\Projects\Samples\Output\";

        private static SvcWssInterop.WssInteropClient wssInteropClient;
        private static string outFilePath;

        static void Main(string[] args)
        {
            try
            {
                 // Use the endpoints that are defined in app.config to configure the client.
                ConfigClientEndpoints(ENDPOINT);

                // Assign the path for the output XML file.
                outFilePath = OUTPUT_DIRECTORY + "WssServersDataSet.xml";

                SvcWssInterop.WssServersDataSet wssServersDs = wssInteropClient.ReadProjectSiteBaseUrls();

                // Write the WssServersDataSet to an XML file.
                DirectoryInfo outDir = new DirectoryInfo(OUTPUT_DIRECTORY);

                if (!outDir.Exists) outDir.Create();

                wssServersDs.WriteXml(outFilePath);

                Console.WriteLine("\nXML output of the WssServersDataSet is at:\n\t{0}", outFilePath);
            }
            catch (CommunicationException e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("\n***System.ServiceModel.CommunicationException:");
                Console.WriteLine(e.ToString());
                Console.ResetColor();
            }
            finally
            {
                Console.Write("\r\n\r\nPress any key....");
                Console.ReadKey();
            }
        }

        // Configure the client endpoints.
        public static void ConfigClientEndpoints(string endpt)
        {
            wssInteropClient = new SvcWssInterop.WssInteropClient(endpt);
        }
    }
}

只有一個基底project sites網站時,此範例會建立C:\Projects\Samples\Output\WssServersDataSet.xml檔案 ( WSTS_SERVER_UID元素和WSS_SERVER_URL元素會包含您自己的值) 的下列內容:

<?xml version="1.0" standalone="yes"?>
<WssServersDataSet xmlns="https://schemas.microsoft.com/office/project/server/webservices/WssServersDataSet/">
  <WssServers>
    <WSTS_SERVER_UID>d1344232-a892-4df9-b74e-5e38396a981a</WSTS_SERVER_UID>
    <WSS_SERVER_URL>http://ServerBase</WSS_SERVER_URL>
  </WssServers>
</WssServersDataSet>

請參閱

參照

WssInterop 類別

WssInterop 成員

WebSvcWssInterop 命名空間