如何区分项目和任务企业领域? [英] How to differentiate between project and task enterprise fields?

查看:60
本文介绍了如何区分项目和任务企业领域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想列出所有项目企业字段及其使用vba的项目值。问题是当我尝试使用GlobalOutlineCodes.Item(index)访问所有企业字段时,它也会返回任务企业字段。如何区分
项目和任务企业字段?我没有数据库访问权限。我需要使用项目对象模型来完成这项工作。

Hi, I want to list all project enterprise fields in and their values for a project using vba. The problem is when I try to access all enterprise fields using GlobalOutlineCodes.Item(index), it returns task enterprise fields also. How do I differentiate between project and task enterprise fields? I do not have database access. I need to do this using project object model.

以下是代码段:

 

  Dim strEFName as string

  Dim strEFName as string

Dim strEFValue as string

Dim strEFValue as string

For i = 1 To GlobalOutlineCodes.Count

For i = 1 To GlobalOutlineCodes.Count

On错误GoTo err2

On Error GoTo err2

strEFName = GlobalOutlineCodes.Item(i).Name

strEFName = GlobalOutlineCodes.Item(i).Name

strEFValue = ActiveProject.ProjectSummaryTask.GetField(FieldNameToFieldConstant(strEFName,pjProject))

strEFValue= ActiveProject.ProjectSummaryTask.GetField(FieldNameToFieldConstant(strEFName, pjProject))

'打印ef名称和值

err2:On Error GoTo -1

err2: On Error GoTo -1

Next

 

推荐答案

这也只会返回长笛,而不是其余的。由于企业字段是在PWA中创建的,我不确定是否可以使用VBA发现它们,您需要知道它们的名称才能在VBA中读取它们的值。

That will also only return outline felds, not the rest. As Enterprise fields are created in PWA, I'm not sure they can be discovered using VBA, you will need to know their names to read their values in VBA.

但另一方面您可以询问Reporting db以读取自定义字段。以_Userview结尾的视图都会自动添加自定义字段。您可以使用OLEDB阅读这些内容。很多例子在msdn.microsoft.com

But on the other hand you can interrogate the Reporting db to read custom fields. The Views ending with _Userview all have custom fields added automatically. You can read these using OLEDB. Plenty of examples at msdn.microsoft.com


这篇关于如何区分项目和任务企业领域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆