Project.DeliverablesGetByProject 方法 (Project)

获取指定的企业项目中,XML 所返回对象的成员的所有可交付结果列表。 项目专家。

语法

expressionDeliverablesGetByProject( _ProjectGuid_ )

表达 一个代表 Project 对象的变量。

参数

名称 必需/可选 数据类型 说明
ProjectGuid 必需 String 企业项目的 GUID。

返回值

Object

备注

使用 VBA 处理 DeliverablesGetByProject 结果对象的 XML 成员要求复杂、 非直观的代码。 我们建议,您使用 Office 和 SharePoint 开发工具Visual Studio 2008在为项目创建外接程序中,当您使用 Project Server 和 SharePoint 功能。 处理 XML 的最简单方法是在.NET Framework 4中使用 LINQ to XML 方法。

示例

在以下示例中,名为简单的企业项目包括可交付的结果设置为命名为 M1 的里程碑。 包含简单项目的可交付结果列表的项目网站 URL 为 https://ServerName/PWA/SimpleTestDeliverables 宏显示消息框,其中包含 XML 结果的一部分。

GetServerProjectGuid 方法所返回的 projectGuid 值包括括号环绕 GUID,例如,"{1b14e65c-5601-4565-acb9-3822078a17fb}"。 使用带或不带大括号的 GUID 值。

Option Explicit 
 
Sub TestDeliverables() 
    Dim projectGuid As String 
    Dim ds As Object 
 
    projectGuid = ActiveProject.GetServerProjectGuid 
 
    ' Optional: Removing the braces on the GUID value makes no difference. 
    ' projectGuid = Mid(projectGuid, 2, 36) 
 
    Set ds = ActiveProject.DeliverablesGetByProject(projectGuid) 
 
    MsgBox ds.XML 
 
    Debug.Print ds.XML 
End Sub

注意

[!注释] 若要查找的类型 对象 ,例如 ds 变量,将一个变量的成员上的对象,设置监视和后将一个值分配给该对象,然后设置断点。 展开 监视窗格中的变量,您可以看到 XML 成员。

消息框中显示只有 XML 结果的总 17,295 字符前 1024年个字符 (在本例中)。 在下面的 XML 结果中,属性被分成若干单独的行。 在同一行,您可以看到是否您打印到 即时窗格在 VBE 中结果是实际的 XML 结果。 此示例不显示 XML 架构,它们组成了大部分内容。

在 SharePoint 列表中定义了 ows_ 字段。 要提取某些字段包括 deliverableUidworkspaceUrilinkedTaskUid (Project Server 的任务 GUID)、 ows_LinkTitle (有的可交付结果任务的名称)、 ows_Createdows_Modifiedows_Authorows_CommitmentStartows_CommitmentFinish

<DeliverableMasterDocument> 
 <Deliverables> 
 <Deliverable deliverableUid="6f8cb9a5-d9b8-496d-af90-1e88dc57f46a" projectUid="1b14e65c-5601-4565-acb9-3822078a17fb" 
 type="1" tpId="1" workspaceUri="https://ServerName/PWA/Simple" workspaceName="PWA/Simple" workspaceVServerUri="https://ServerName" 
 listUid="168a6e6f-6993-4315-a593-7ffa21683e57" state="1"> 
 <Client linkedTaskUid="d3eaf532-9ab9-4eb2-8f85-fd41a1b5db0c" ows_ID="1" 
 ows_ContentTypeId="0x010074416DB49FB844B99C763FA7171E7D1F00001031A192BFCA4D83CA160D2BCAB735" 
 ows_ContentType="Project Site Deliverable" ows_Title="M1" ows_Modified="2010-02-19 13:30:19" 
 ows_Created="2010-02-19 13:29:45" ows_Author="1073741823;#System Account" 
 ows_Editor="1073741823;#System Account" ows_owshiddenversion="2" ows_WorkflowVersion="1" 
 ows__UIVersion="512" ows__UIVersionString="1.0" ows_Attachments="0" ows__ModerationStatus="0" 
 ows_LinkTitleNoMenu="M1" ows_LinkTitle="M1" ows_LinkTitle2="M1" ows_SelectTitle="1" 
 ows_Order="100.000000000000" ows_GUID="{FFA3E0F9-DBB4-44B6-B09D-1C2AB7A9EF92}" 
 ows_FileRef="1;#PWA/Simple/Lists/Deliverables/1_.000" ows_FileDirRef="1;#PWA/Simple/Lists/Deliverables" 
 ows_Last_x0020_Modified="1;#2010-02-19 13:29:45" ows_Created_x0020_Date="1;#2010-02-19 13:29:45" 
 ows_FSObjType="1;#0" ows_SortBehavior="1;#0" ows_PermMask="0x7fffffffffffffff" ows_FileLeafRef="1;#1_.000" 
 ows_UniqueId="1;#{29AF34EA-EA27-48C7-80A6-83B0A95DB9BD}" ows_ProgId="1;#" 
 ows_ScopeId="1;#{73C1A12E-DBA2-4BE2-87EE-1FF5EF1494DD}" ows__EditMenuTableStart="1_.000" 
 ows__EditMenuTableStart2="1" ows__EditMenuTableEnd="1" ows_LinkFilenameNoMenu="1_.000" 
 ows_LinkFilename="1_.000" ows_LinkFilename2="1_.000" ows_ServerUrl="/PWA/Simple/Lists/Deliverables/1_.000" 
 ows_EncodedAbsUrl="https://jc2vm1/PWA/Simple/Lists/Deliverables/1_.000" ows_BaseName="1_" ows_MetaInfo="1;#" 
 ows__Level="1" ows__IsCurrentVersion="1" ows_ItemChildCount="1;#0" ows_FolderChildCount="1;#0" 
 ows_CommitmentStart="2010-02-02 00:00:00" ows_CommitmentFinish="2010-02-02 00:00:00" ows_SuppressCreateEvent="1"/> 
 </Deliverable> 
 </Deliverables> 
 <Schemas> 
 <Schema . . . 
 . . . > 
 <Fields> 
 <Field . . . /> 
 . . . 
 </Fields> 
 </Schema> 
 </Schemas> 
</DeliverableMasterDocument>

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。