Thursday, September 23, 2010

Create new site programmatically in workflow

private void codeActivity1_ExecuteCode(object sender, EventArgs e)
        {
            SPWeb web = workflowProperties.Web;
            SPSite site = workflowProperties.Site;
            SPListItem lst = workflowProperties.Item;
            string title = lst["Title"].ToString();
            string url = title.Replace(' ', '-');
            if (!web.Webs["title"].Exists)
            {
                SPWeb wb = web.Webs.Add(url);
                lst["weburl"] = wb.Url;
                lst.Update();
                web.Update();
            }
            

        }

No comments:

Post a Comment