WssInterop.ReadProjectSiteBaseUrls 方法
读取 web 应用程序的 Guid 和基网站可用于创建项目网站的 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
列出的 web 应用程序配置为允许创建项目网站。
备注
WssServersDataTable包含每个 web 应用程序配置为允许创建项目网站的行。数据包括仅WSTS_SERVER_UID属性和WSS_SERVER_URL属性。
ReadProjectSiteBaseUrls方法填充Project Web App (https://ServerName/ProjectServerName/_layouts/pwa/Admin/UpdateSites.aspx) 中的批量更新项目网站页中的Web 应用程序下拉列表。ReadProjectSiteBaseUrls方法通常用于为UpdateProjectSitePaths方法获取数据。
Project Server 权限
权限 |
说明 |
---|---|
允许用户管理项目网站。全局权限。 |
示例
下面的示例使用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 Project 2013 中基于 WCF 的代码示例的先决条件.
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);
}
}
}
如果没有为项目网站只有一个基本网站,该示例将创建具有以下内容 ( WSTS_SERVER_UID元素和WSS_SERVER_URL元素将包含您自己的值) C:\Projects\Samples\Output\WssServersDataSet.xml文件:
<?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>