Skip to main content

Hi


We are trying to add the K2 Worklist web part to the users my sites programmatically for them to be able to interact to with the worklist. The worklist web part adds correctly to the specified zone but keeps the default propertied of Localhost for the K2HostServer and K2Server properties.



I have tried setting the webpart.Configuration.K2HostServer = "server" and webpart.Configuration.K2Server = "server".
After which i save the web part and savechanges to the Web Part Manager on the page.Still didn't work


 


I have tried to set the SerializedConfiguration to the XML that the web part generates once set manually, but this proved to be not working either.



Is there any other way to add the web part to a SharePoint web part page programmatically?


Extract of code:
SPLimitedWebPartManager theMan = thePage.GetLimitedWebPartManager(System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared);


TaskListWebPartFactory newTaskList = new TaskListWebPartFactory();


newTaskList.Title = "K2 Worklist";


newTaskList.Configuration.K2HostServerName = "compcom01";


newTaskList.Configuration.K2Server = "compcom01";


theMan.AddWebPart(newTaskList, "TopZone", 0);


theMan.SaveChanges(newTaskList);

Be the first to reply!

Reply