none
How to assign add OOTB Reminders web part programatically to custom page..? RRS feed

  • Question

  • I'm adding PWA Reminders web part programmatic to one of my custom page as shown in following code snippet;

    SPLimitedWebPartManager HomePageManager = currentWeb.GetLimitedWebPartManager(list.RootFolder.Url + "/Home.aspx" , System.Web.UI.WebControls.WebParts.PersonalizationScope .Shared);

     

           RemindersPart reminderWebPart = new RemindersPart ();

           reminderWebPart.Title = "My PWA Reminders" ;

           string strPWAURL = currentWeb.Site.RootWeb.Url;

           reminderWebPart.PsiUrl = strPWAURL;

           HomePageManager.AddWebPart(reminderWebPart, "Header" , 4);

           HomePageManager.CacheInvalidate(reminderWebPart, Storage .Shared);

           HomePageManager.SaveChanges(reminderWebPart);

     

    Here, web part is added properly to page but give error with message as;

    " Could not connect to Project Server. This could be because there is no Project Server specified for this site. Contact your server administrator to set a default Project Server URL for the "Reminders" web part. If you have manually changed the Project Server URL for this web part, please remove the web part and add it to the page again from the web part catalog.
    ".

     

    Any help how we can add this web part to our custom page during feature activation only..?

    Above code works fine if called from a custom web part's create child control and this custom web part is added to to our page. But issue is when we call this frm Feature event receiver.

     

     

     

     


     

    Wednesday, July 28, 2010 1:40 PM

All replies

  • Hi AshutoshG,

    Is this custom page within your Project Server farm?  If you deploy via this means are you able to manually set the Project Web App URL in the properties via Edit Web Part (down at the bottom of the list, after Appearance and layout).  If you can and this works then we can try and find out if this property can be set programatically.  Are you looking to be able to deploy this to different PWA instances and automatically pick up the PWA Url?

    Best regards,

    Brian


    Blog | Facebook | Twitter | Posting is provided "AS IS" with no warranties, and confers no rights.
    Project Server TechCenter | Project Developer Center | Project Server Help | Project Product Page
    Thursday, July 29, 2010 7:50 PM
    Owner
  • Hi Brian,

     

    Thanks for your support.

    I'm adding this reminder web part programmatic  on my custom .aspx page. I know we can set PWA url in web part edit mode at the bottom.

    But my requirement is to add web part and set PWA url programatically.

    I have the PWA url with me.

    For example;

    I'm on PWA site and activating a feature which will create a child (say 'CH1') site and activate some features on this CH1.

    At the same time, i'm adding the "Reminder part" webpart to one of my custom page.

    Also, it doesn't give any exception while adding...just dont show up in the page.

    :-(

     

    Thanks,

    Ashutosh

     

     

     

    Friday, July 30, 2010 6:10 AM