none
Get enterprise custom fields in SharePoint 2010 with visual studio 2010 RRS feed

  • Question

  • In my system, user have to fill several enterprise custom fields when he create a project in project server.

    And for each project, it has one Sharepoint project site. 

    I need get the metadata of the project (enterprise custom fields) and use that in the sharepoint project site.

    I found a web part application WorkspaceProjectCFWP in the site http://archive.msdn.microsoft.com/P2010SolutionStarter, but it can only shows the metadata in the workspace, but not manipulate...

    After some research in Internet, the solution seems to build a custom web part for SharePoint 2010 with Visual Studio 2010.

    The problem is how can I access the that metadata, show them and use them to build several URL in Sharepoint  project site?

    The system version is SharePoint 2010 in a server Windows 2008. And also Project server 2010, visual studio professional 2010.

    I am a new man in Sharepoint and project server, so any help is appreciated, some example of code is great.

    Thanks!

     

    Tuesday, March 1, 2011 8:48 AM

Answers

  • Based on the example you refer to, it is quit easy to extend this to a data entry webpart. On the postback (add a button); you can call a webservice that writed the values back to the project itself.

    This function in your webpart will give you the project UID; start here and use the SDK or projTool as examples:

        private Guid? GetCurrentProjectUid()
        {
          SPWeb currentWeb = SPContext.Current.Web;
          if ((currentWeb.WebTemplateId >= WSS.WssPWSTemplateNumericIdMinLimit) &&
            (currentWeb.WebTemplateId <= WSS.WssPWSTemplateNumericIdMaxLimit))
          {
            string webPropProjUid = currentWeb.AllProperties["MSPWAPROJUID"] as string;
            if (!string.IsNullOrEmpty(webPropProjUid))
            {
              return new Guid(webPropProjUid);
            }
          }
          return null;
        }
    

    Regards, J
    Thursday, March 10, 2011 12:00 PM