none
How to get projectsiteurl of a published project RRS feed

  • Question

  • I am using csom to get project site url of all projects in project server 2013(online)

    i tried p.ProjectSiteUrl which ends up throwing an exception  " property or field 'ProjectSiteUrl' has not been initialized. it has not been requested or request has not been executed it may need to be explicitly requested  "

    foreach (PublishedProject p in projContext.Projects)
        {
                          
           Console.WriteLine("Name : "+ p.Name +"\n url :"+p.ProjectSiteUrl);

         }


    Ranjith

    Monday, June 9, 2014 11:48 AM

Answers

  • Hi Ranjith,

    You need to load the property before calling it. Please use the code below to get ProjectSiteUrl,

    foreach (PublishedProject p in projContext.Projects)
                    {
                        projContext.Load(p, pp => pp.ProjectSiteUrl);
                        projContext.ExecuteQuery();
                        Console.WriteLine("Name : " + p.Name + "\n url :" + p.ProjectSiteUrl);
                    }


    PSN

    Monday, June 9, 2014 12:35 PM

All replies

  • Hi Ranjith,

    You need to load the property before calling it. Please use the code below to get ProjectSiteUrl,

    foreach (PublishedProject p in projContext.Projects)
                    {
                        projContext.Load(p, pp => pp.ProjectSiteUrl);
                        projContext.ExecuteQuery();
                        Console.WriteLine("Name : " + p.Name + "\n url :" + p.ProjectSiteUrl);
                    }


    PSN

    Monday, June 9, 2014 12:35 PM
  • Thanks..


    Ranjith

    Tuesday, June 10, 2014 5:18 AM