Resource.ReadResourceAvailabilityForGrid 方法
此成员仅供内部使用,不能直接在您的代码中使用。返回JS 网格控件的按时间分段的数据结构中的资源可用性的数据集。
命名空间: WebSvcResource
程序集: ProjectServerServices(位于 ProjectServerServices.dll 中)
语法
声明
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Resource/ReadResourceAvailabilityForGrid", RequestNamespace := "https://schemas.microsoft.com/office/project/server/webservices/Resource/", _
ResponseNamespace := "https://schemas.microsoft.com/office/project/server/webservices/Resource/", _
Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function ReadResourceAvailabilityForGrid ( _
resUIDs As Guid(), _
startDate As DateTime, _
endDate As DateTime, _
timeScale As Short, _
includeProposedBookings As Boolean _
) As DataSet
用法
Dim instance As Resource
Dim resUIDs As Guid()
Dim startDate As DateTime
Dim endDate As DateTime
Dim timeScale As Short
Dim includeProposedBookings As Boolean
Dim returnValue As DataSet
returnValue = instance.ReadResourceAvailabilityForGrid(resUIDs, _
startDate, endDate, timeScale, includeProposedBookings)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Resource/ReadResourceAvailabilityForGrid", RequestNamespace = "https://schemas.microsoft.com/office/project/server/webservices/Resource/",
ResponseNamespace = "https://schemas.microsoft.com/office/project/server/webservices/Resource/",
Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public DataSet ReadResourceAvailabilityForGrid(
Guid[] resUIDs,
DateTime startDate,
DateTime endDate,
short timeScale,
bool includeProposedBookings
)
参数
resUIDs
类型:[]资源 Guid 的数组。
startDate
类型:System.DateTime期初。
endDate
类型:System.DateTime期结束。
timeScale
类型:System.Int16所需的TimephasedData表、 TimeScaleClass.TimeScale枚举中的小数位数。
includeProposedBookings
类型:System.Boolean包括仅暂时计划资源的分配。
返回值
类型:System.Data.DataSet
使用表的日期和时间分段数据的表的数据集。
备注
ReadResourceAvailabilityForGrid方法与JS 网格控件内部使用。若要获取资源可用性数据,请使用ReadResourceAvailability方法。
Project Server 权限
权限 |
说明 |
---|---|
允许用户查看资源分配数据。全局权限。 |
示例
The example uses the SvcResource 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 的代码示例的先决条件.
ReadResourceAvailabilityForGrid方法将返回数据集resourceGridDS。数据集的内容写入ResourceAvailabilityGrid.xml。从实际的输出TimephasedData结构示例如下所示:
备注
ReadResourceAvailabilityForGrid方法等同于ReadResourceAvailability方法中,除了 ReadResourceAvailabilityForGrid 方法不会返回资源 GUID 或DataSet中的项目的 GUID。 ReadResourceAvailabilityForGrid仅在用于Project Web App JS 网格中显示的数据
<TimephasedData>
<AssignmentUID>2ba3b898-3fa7-421b-8643-56f0088e7cae</AssignmentUID>
<ProjectName>Capacity</ProjectName>
<ResourceName>Fourth Coffee </ResourceName>
<RowType>0</RowType>
<Interval0>72000</Interval0>
<Interval1>96000</Interval1>
<Interval2>110400</Interval2>
<Interval3>105600</Interval3>
<Interval4>100800</Interval4>
<Interval5>19200</Interval5>
</TimephasedData>
下面给出了完整的代码示例:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.ServiceModel;
using PSLibrary = Microsoft.Office.Project.Server.Library;
namespace Microsoft.SDK.Project.Samples.Resources
{
class Resources
{
private static SvcResource.ResourceClient resourceClient;
private const string RES_ENDPOINT = "basicHttp_Resource";
private const string OUTPUT_FILES = @"C:\Projects\Samples\Output\";
private static string outFilePathResourcesAvailabilityGrid;
private static string outFilePathResourceAvailability;
static void Main(string[] args)
{
Guid[] resourceID = new Guid[2];
resourceID[0] = new Guid("2a4ba1a7-1d96-4086-8fa5-6dea243ed6b5");
resourceID[1] = new Guid("f6c846fa-b21b-49eb-9921-fe6bdec60242");
DateTime startDate = new DateTime(2010, 1, 10);
DateTime finishDate = new DateTime(2010, 6, 6);
// Configure the end points.
ConfigClientEndpoints(RES_ENDPOINT);
// If directory does not exist,create it.
if (!Directory.Exists(OUTPUT_FILES))
{
Directory.CreateDirectory(OUTPUT_FILES);
}
// Assign the path where the output XML file will be saved.
outFilePathResourcesAvailabilityGrid = OUTPUT_FILES + "ResourcesAvailabilityGrid.xml";
outFilePathResourceAvailability = OUTPUT_FILES + "ResourceAvailability.xml";
// Read the resource availability.
System.Data.DataSet resourceGridDS = resourceClient.ReadResourceAvailabilityForGrid(
resourceID, startDate, finishDate, (short)PSLibrary.Resource.TimeScale.Months, true);
// Write the contents of the DataSet to an XML file.
resourceGridDS.WriteXml(outFilePathResourcesAvailabilityGrid);
Console.WriteLine("\nSee XML output of the DataSet at {0}",
outFilePathResourcesAvailabilityGrid);
// Read the resource availability for grid.
System.Data.DataSet resourceDS = resourceClient.ReadResourceAvailability(
resourceID, startDate, finishDate, (short)PSLibrary.Resource.TimeScale.Months, true);
// Write the DataSet contents to an XML file.
resourceDS.WriteXml(outFilePathResourceAvailability);
Console.WriteLine("\nSee XML output of Resource Dataset at {0}",
outFilePathResourceAvailability);
Console.ReadKey();
}
// Configure the custom field client end points.
public static void ConfigClientEndpoints(string endpt)
{
resourceClient = new SvcResource.ResourceClient(endpt);
}
}
}