有没有办法获取 Project Server 上用户正在使用的所有企业字段的列表?

Is There a way to get a List of all the Enterprise Fields a user on Project Server has In Use?

我正在构建一个 MS Project VSTO 工具(用 C# 编写),在许多情况下需要从 MS Project 中的字段读取或写入数据。因为我并不总是知道哪个字段将包含我需要的数据,所以我很多时候需要允许用户选择 select 他们想要的字段。获取所有基本字段很容易,如果用户在 Project Server 环境中并使用企业字段,就会出现我的问题。所以我的问题是 2 折:

  1. 有没有办法检查用户是否在 Project Server 环境中?
  2. 有没有办法轻松获取在 MS Project 中使用的所有自定义企业字段?我希望能够在列表或数组等集合中捕获这些字段。

Is there a way to check if the user is in a Project Server environment?

查看 Profiles to see if there is a project server one and check its ConnectionState 的集合,看看它是否连接到项目服务器。

Is there a way to easily get all of the custom enterprise fields that are being used in MS Project? I'd like to be able to capture these fields in a collection like a list or array.

如果您可以访问项目服务器,请查看此页面,Accessing Project Online enterprise custom fields。如果无法访问服务器,我建议:

  • 遍历所有表及其字段以查找企业表。
  • 允许用户输入企业字段的名称并存储该信息以供将来使用,以便用户一次性 'setup'。