开发者

creating a sharepoint site from clearQuest web server

开发者 https://www.devze.com 2023-01-23 04:08 出处:网络
I have a clearQuest Web (running on L开发者_如何学编程inux) and wants to create a sharepoint site when a new record is created (using a perl script).

I have a clearQuest Web (running on L开发者_如何学编程inux) and wants to create a sharepoint site when a new record is created (using a perl script). How can I do it - is there any sharepoint web service that I can use to create a site. I beleive that I need a perl module for web services, how do I add it to the perl installation of the clearQuest web server ?

Does any one has expirienc with this ?


I have not worked with perl script. But check out http://sharepoint site/_vti_bin/sites.asmx webservice. This webservice can be used manage sites.


I created a custom web service for creating sites in SharePoint (WSS 3), as I couldn't find a way to do it using the existing web services.

The code looks something like this:

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class CreateSiteWebService : System.Web.Services.WebService
{

    [WebMethod]
    public string CreateSite(
            string strWebUrl,
            string strTitle,
            string strDescription,
            uint nLCID,
            string strWebTemplate,
            bool useUniquePermissions,
            bool bConvertIfThere
        )

    {
        SPWeb newWeb = null;
        SPSite site = SPContext.Current.Site;
        newWeb = site.RootWeb.Webs.Add(strWebUrl, strTitle, strDescription, nLCID, strWebTemplate, useUniquePermissions, bConvertIfThere);
        newWeb.Navigation.UseShared = true;
        newWeb.Update();
        //try to get it to appear in quick launch:
        SPNavigationNodeCollection nodes = web.Navigation.QuickLaunch;
        SPNavigationNode menuNode = null;
        foreach(SPNavigationNode n in nodes)
        {
            if (n.Title == "Sites")
            {
                menuNode = n;
                break;
            }
        }
        if (menuNode == null)
        {
            menuNode = new SPNavigationNode("Sites", site.Url + "/_layouts/viewlsts.aspx?ShowSites=1", false);
            nodes.AddAsFirst(menuNode);
        }
        SPNavigationNode navNode = new SPNavigationNode(strTitle, strWebUrl, false);
        menuNode.Children.AddAsLast(navNode);
        parent.Update();
        parent.Dispose();

        site.Dispose();
        string url = newWeb.Url;
        newWeb.Dispose();
        return url;
    }
}

Hope that helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消