sharepoint中在blog中,发布post可以直接打开 word 发布!(Launch blog program to post用代码实现)

MSDN:http://social.microsoft.com/Forums/zh-CN/partnercndevsharepoint/thread/9d9a6bc4-2dfe-4d98-9c3f-fe33dcd6d18d

嘿,大家好!

在sharepoint blog站点里面,有个"Launch blog program to post " 按钮可以直接打开word发布Post! 如果是第一次打开会弹出下面注册!

查看源文件,他是调用init.js 里面的function newBlogPostOnClient(strProviderId, strBlogUrl, strBlogName);

protected void BtnTestBlog_Click(object sender, EventArgs e)
    {
        //这句是我在sharepoint里面拷贝出来的
        //javascript:newBlogPostOnClient(%2718faf3ff-2cdd-4f17-9b7c-b11d0116f405%27,%20%27http://jianghao:9000/personal/hao_jiang/Blog%27,%20%27e861d78e-6e8d-4afb-93b4-89416bc4c071#e819785b-954f-41a9-9bbf-e0f6df91b76a')"
        /*
         * 第一个参数:固定参数
         * 第二个参数:博客地址
         * 第三个参数:博客ID+"#"+GUID
         */
        //Dwn("str1======"+Server.UrlDecode("%27"));
        //Dwn("str2======" + Server.HtmlDecode("%27"));
        //Dwn(""); 就是 Response.Write("");
        using (SPSite site = new SPSite("http://jianghao:9000/personal/hao_jiang"))
        {
            using (SPWeb rootWeb = site.RootWeb)
            {
                SPWeb web = rootWeb.Webs["Blog"];
                Dwn("ID=="+web.ID);
                Dwn("URL=="+web.Url);
                Dwn("ServerRelativeUrl==" + web.ServerRelativeUrl);
                Dwn("CurrencyLocaleID==" + web.CurrencyLocaleID);
                Dwn("ParentWebId==" + web.ParentWebId);
                string urlStr = "javascript:newBlogPostOnClient('18faf3ff-2cdd-4f17-9b7c-b11d0116f405',";
                urlStr += "'" + web.Url + "',";
urlStr += "'" + web.ID + "#2cefe993-04d1-4e4e-80b2-04c47bcbbba6" + "')";
                //页面有个:<asp:HyperLink ID="hlAdmlnk5" runat="server">Open word</asp:HyperLink>
                hlAdmlnk5.NavigateUrl = urlStr;
                /*
                 * 现在的问题是: word可以打开写post和发布了!就是如果自己拼接的#号后面的guid和sharepoint里面的
                 * 不相同,他会每次弹出注册窗口,而sharepoint则只会弹出一次!
                 * 请问 # 号后面的guid 是什么意思,如何取得?
                 * 谢谢
                 * /
                /*
                System.Collections.Hashtable ht = web.AllProperties;
                foreach (var item1 in ht.Keys)
                {
                    //Dwn(item1 + "====>" + ht[item1]);
                }
                Microsoft.SharePoint.Utilities.SPPropertyBag bag = web.Properties;
                foreach (var item in bag.Keys)
                {
                    //Dwn(item + "===>" + bag[item.ToString()]);
                }
                 * */
            }
        }
    }

不知我描述清楚没有!

期待你的答复!谢谢!

补充:我已在页面添加了引用:

<script type="text/javascript" language="javascript" src="http://jianghao:9000/_layouts/1033/init.js?rev=ck%2BHdHQ8ABQHif7kr%2Bj7iQ%3D%3D"></script>
<script type="text/javascript" language="javascript" src="http://jianghao:9000/_layouts/1033/core.js?rev=S5dt4K8TJGVTYU9HrW6enw%3D%3D" defer></script>

 

在提这个问题之前!我在不同sharepoint站点的blog站点下面 "Launch blog program to post " 调用的脚本copy到记事本里面!

我发现他们#号后面的guid都不相同!

点击sharepoint 的 "Launch blog program to post " ,注册框只会弹出一次!而以后再点击它不会弹出! 我认为#号后面的guid是否是记录是否为第一次弹出注册框 !

而在自己的代码中只要#号后面的guid不与sharepoint中#号后面的Guid相同,虽然第一次弹出了,但是以后都会弹出注册框!

我把sharepoint里面#号后面的guid复制到自己代码#号后面的guid里面的,他的效果就和sharepoint里面一样了! 但是程序是动态的

 

Technorati 标签:

你可能感兴趣的:(SharePoint)