随笔 - 66  文章 - 0 评论 - 9 trackbacks - 0

最近同事的项目中,

打开一个页面的时候,发现

The maximum number of Web Parts for all zones on this page has been exceeded.
如此信息,使用SPD打开页面的时候,发现同一WebPart重复10多次,

 

那么一个页面可以有多少个Web Part呢?

The limit is customizable in web.config file,
50 (default) - http://technet.microsoft.com/en-us/library/cc262787.aspx
100 (recommended max) - http://technet.microsoft.com/en-us/library/cc287743.aspx

 

最终的原因参考

http://vivek-soni.blogspot.com/2010/08/duplicate-web-parts-shown-in-sharepoint.html

 

Issue:
Using the same
web part zone GUID multiple times whether in same page layout or a different
page layout would result into the web part being shown up multiple times.

Resolution:

Ensure that
every web part zone and web part in your page layouts have a unique GUID across
your site collection.

posted @ 2012-02-01 11:01 逐风流浪 阅读(38) 评论(0) 编辑

项目中,要做个一个小工具(客户端的),导出网站的页面,字段值,Web Part文件。还有我只是打酱油的。

同事留了两个问题给我。

1. 如何导出字段值

2. 如何导出WebPart文件

 

第一个问题还好,第二个问题。

检查了Client Object的三个WebPart相关的主要类

LimitedWebPartManager

WebPart

WebPartDefinition

没有重大发现,C# SharePint 服务端代码有Export方法。

 

于是想到 REST,Silver Client Model, ECMScript Client Object,Web Service.

逐渐的放弃了,最后研究到 WebService,发现有个

_vti_bin/WebPartPages.asmx

,再细心的查找。

关注

GetWebPartPage

GetWebPartPageConnectionInfo

GetWebPartPageDocument

GetWebPartProperties

GetWebPartProperties2

最后 GetWebPartProperties2就是答案,真够2的。

返回的值就是 <WebParts><WebPart>...</WebPart>...</WebParts>的格式

这解析还弄死我,唉,学艺不精真惨。


 

 

 

posted @ 2012-01-11 17:04 逐风流浪 阅读(6) 评论(0) 编辑

http://msdn.microsoft.com/en-us/library/ff798328.aspx

 

How to: Enable ECMA Client Object Model IntelliSense in Visual Studio 2010

Overview

The Microsoft® SharePoint® 2010 ECMA Client Object Model allows developers to interact with SharePoint from JavaScript code running in a Web browser. This topic shows you how to enable Microsoft IntelliSense® for the ECMA Client Object Model in the Microsoft Visual Studio® 2010 development system.

This how-to topic describes the following procedures:

  • Enabling ECMA Client Object Model IntelliSense for an application page
  • Enabling ECMA Client Object Model IntelliSense for a Visual Web Part
  • Enabling ECMA Client Object Model IntelliSense for a standalone JavaScript file
Ff798328.note(en-us,PandP.10).gifNote:
This how-to topic assumes that you have created a project in Visual Studio 2010 by using the Empty SharePoint Project template.

Enabling ECMA Client Object Model IntelliSense for an Application Page

This procedure registers script tags in an application page. This allows Visual Studio 2010 to provide ECMA Client Object Model IntelliSense for the application page.

To enable ECMA Client Object Model IntelliSense for an application page

  1. In the Solution Explorer window, right-click the project node, point to Add, and then click New Item.
  2. In the New Item dialog box, in the Installed Templates pane, expand Visual C#, expand SharePoint, and then click 2010.
  3. To the right of the Installed Templates pane, click Application Page.
  4. In the Name box, type the name that you want to use for your application page.
  5. Click Add.
  6. On the application page, in the PageHead content placeholder, add the following code.
    <% #if SOME_UNDEFINED_CONSTANT %>
    <script type="text/javascript" src="/_layouts/SP.debug.js" ></script>
    <% #endif %>
    
    Ff798328.note(en-us,PandP.10).gifNote:
    Note: by using an undefined constant, Visual Studio will provide Intellisense while the <script> element is omitted from the actual page rendering

    Notice that the Visual Studio 2010 status bar indicates that it is updating the JavaScript IntelliSense for your page, as shown by the following illustration.

    Ff798328.a39fca9a-f7f9-49d2-8747-a5e3bc70f755(en-us,PandP.10).png

  7. On the application page, in the PageHead content placeholder, use the following code to add another script tag and create a JavaScript function.
    <script type="text/javascript" language="javascript">
      ExecuteOrDelayUntilScriptLoaded(test, "sp.js");
    
      function test() {
        this.ClientContext = SP.ClientContext.get_current();
      }
    </script>
    

    Notice the IntelliSense is available for the ECMA Client Object Model, as shown by the following illustration.

    Ff798328.a1d7e208-694a-419e-a22a-97acaf3bfb4a(en-us,PandP.10).png

    Ff798328.note(en-us,PandP.10).gifNote:
    Depending on the portions of the object model that you are working with, you might need to add script tags that reference other SharePoint Client Object Model .js files. These files can be found in the _layouts virtual directory.

Enabling ECMA Client Object Model IntelliSense for a Visual Web Part

This procedure registers script tags in a Visual Web Part. This allows Visual Studio 2010 to provide ECMA Client Object Model IntelliSense for a Visual Web Part.

To enable ECMA Client Object Model IntelliSense for a Visual Web Part

  1. In the Solution Explorer window, right-click the project node, point to Add, and then click New Item.
  2. In the New Item dialog box, in the Installed Templates pane, expand Visual C#, expand SharePoint, and then click 2010.
  3. To the right of the Installed Templates pane, click Visual Web Part.
  4. In the Name box, type the name that you want to use for your Visual Web Part.
  5. Click Add.
  6. In the Visual Web Part .ascx file, add the following code.
    <% #if SOME_UNDEFINED_CONSTANT %>
     <script type="text/javascript" src="/_layouts/MicrosoftAjax.js" ></script>
     <script type="text/javascript" src="/_layouts/SP.debug.js"></script>
    <% #endif %>
    

    Notice that the Visual Studio 2010 status bar indicates that it is updating the JavaScript IntelliSense for your page, as shown by the following illustration.

    Ff798328.ae6fe69f-bc73-4a0f-85c6-7865da239c87(en-us,PandP.10).png

  7. In the Visual Web Part ASCX file, use the following code to add another script tag and create a JavaScript function.
    <script type="text/javascript" language="javascript">
      ExecuteOrDelayUntilScriptLoaded(test, "sp.js");
    
      function test() {
        this.ClientContext = SP.ClientContext.get_current();
      }
    </script>
    

    Notice that IntelliSense is now available for the ECMA Client Object Model, as shown by the following illustration.

    Ff798328.0449199a-bc46-4828-9103-6392ebdaedc5(en-us,PandP.10).png

    Ff798328.note(en-us,PandP.10).gifNote:
    Note: Depending on the portions of the object model that you are working with, you might need to add tags that reference other SharePoint Client Object Model .js files. These files can be found in the _layouts virtual directory.
    You should remove the references to the .js files that enable IntelliSense when you deploy the Visual Web Part in a production environment.

Enabling ECMA Client Object Model IntelliSense for a Standalone JavaScript File

This procedure registers script tags in a standalone JavaScript file. This allows Visual Studio 2010 to provide ECMA Client Object Model IntelliSense for a standalone JavaScript file.

To enable ECMA Client Object Model IntelliSense for a standalone JavaScript file

  1. In the Solution Explorer window, right-click the project node, point to Add, and then click New Item.
  2. In the New Item dialog box, in the Installed Templates pane, expand Visual C#, and then click Web.
  3. To the right of the Installed Templates pane, click Jscript File.
  4. In the Name box, type the name that you want to use for your JavaScript file.
  5. Click Add.
  6. In the JavaScript file, add the following code.
                JavaScript       
    /// <reference path="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\MicrosoftAjax.js" />
    /// <reference path="C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\SP.debug.js" />
    

    Notice that the Visual Studio 2010 status bar indicates that it is updating the JavaScript IntelliSense for your page, as shown by the following illustration.

    Ff798328.e72c3f70-1936-440a-8a08-bdbcc9da159c(en-us,PandP.10).png

  7. In the JavaScript file, add the following code.
                JavaScript       
    ExecuteOrDelayUntilScriptLoaded(test, "sp.js");
    
    function test() {
        this.ClientContext = SP.ClientContext.get_current();
    }
    

    Notice that IntelliSense is now available for the ECMA Client Object Model, as shown by the following illustration.

    Ff798328.d3abb77b-866e-4d13-a266-35e2195c86e4(en-us,PandP.10).png

    Ff798328.note(en-us,PandP.10).gifNote:
    Note: Depending on the portions of the object model that you are working with, you might need to add tags that reference other SharePoint Client Object Model .js files. These files can be found in the _layouts virtual directory.
    You should remove the references to the .js files that enable IntelliSense when you deploy the standalone JavaScript file in a production environment.

© 2011  Microsoft. All rights reserved.Terms of Use|Trademarks|Privacy Statement
posted @ 2011-12-21 16:48 逐风流浪 阅读(7) 评论(0) 编辑

VS2010技巧:如何在js文件中使用jQuery智能感知

作者: Ferry Meidianto  发布时间: 2010-06-01 11:09  阅读: 6046 次  原文链接  全屏阅读  [收藏] 

  在VS2010中,先打开相应的js文件,然后将Scripts目录中jQuery文件拖动到该js文件中。

posted @ 2011-12-21 16:42 逐风流浪 阅读(15) 评论(0) 编辑

在SharePoint2010中,Search和CBQ返回XML数据,

如何知道这数据结构呢?

好吧

代码一段

 

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xmp><xsl:copy-of select="*"/></xmp>
</xsl:template>
</xsl:stylesheet>  

 

有用的,你懂得。 

标签描述
<code>定义计算机程序代码
<kbd>定义键盘文本
<samp>定义计算机程序输出结果
<tt>定义打字机文本
<var>定义变量
<pre>定义预先排版的文本
<listing>被弃用的,请用<pre>替代
<plaintext>被弃用的,请用<pre>替代
<xmp>被弃用的,请用<pre>替代

 

 

posted @ 2011-12-20 17:03 逐风流浪 阅读(41) 评论(0) 编辑

电脑不断的补丁,突然一天,我**,感觉很多网站(www网站)js都不起作用了。

浏览SharePoint list的时候,IE上面出现一栏文字

You may be trying to access this site from a secured browser on the server. Please enable scripts and reload this page

我**,于是 google

答案就是:

http://www.fewlines4biju.com/2011/03/you-may-be-trying-to-access-this-site.html

 

Start ->

Administrative Tools ->

Server Manager ->

in the right hand side Configure IE ESC ->

Select Off for Administrators and click OK.

 

我的个去。希望碰见同样问题的人,。。。。

 

posted @ 2011-12-20 10:58 逐风流浪 阅读(17) 评论(0) 编辑

昨天客户打开点击文档库的ics文件时,

说为什么没有打开选项?

 

 

 

于是,啊,各种的悲剧测试,

最后发现 。

http://claytoncobb.wordpress.com/2011/01/07/sharepoint-2010-how-to-open-files-that-prompt-for-save-or-cancel/

居然是配置问题。

application 的general setting中的配置。

当然这不仅仅是针对ics文件的。

配置后就能得到如下结果。

希望对大家有帮助。

有些时候也要考虑跨网站的因素。

posted @ 2011-12-06 09:49 逐风流浪 阅读(41) 评论(0) 编辑
摘要: 今天在给Html控件注册事件的时候,发生了奇怪的现象最初的代码,$(document).ready(function () {$("#blog1").click(function () { setTab('blog', 1,5) }); $("#blog2" ).click(function () { setTab('blog', 2,5) }); $("#blog3" ).click(function () { setTab('blog', 3,5) }); $("#blog阅读全文
posted @ 2011-12-01 17:17 逐风流浪 阅读(40) 评论(0) 编辑
摘要: CSS选择器参考:http://www.w3.org/TR/CSS/#css3http://www.w3.org/TR/css3-selectors/http://www.w3.org/TR/css3-selectors/最近碰见一个问题:就是换行的问题,原本的P标签,是有换行标记的,结果在css文件中,被设置 margin:0 0 0 0;这就没有换行的痕迹了。客户说:要换行啊。leader说:可以,但是原来的P标签这么设置,影响太多,新加一个样式,想换行就自己加上,提供两种模式1.<div class="doubleline"> <p> ....阅读全文
posted @ 2011-11-25 14:24 逐风流浪 阅读(7) 评论(0) 编辑
摘要: 原文地址:http://www.cnblogs.com/chenxizhang/archive/2011/08/06/2129659.html配置基于SharePoint 2010的Forms Service,可能遇到一些问题,就是表单模板上传之后,点击创建后却无法呈现。错误消息如下:关于这个问题,大致的意思是,可能没有启用状态服务。可以参考下面的文章http://www.nanmu.net/sharepoint2010/sharepoint-2010-english/Lists/Posts/Post.aspx?ID=20按照下面的红色标出的命令,依次执行之后,问题已经解决。摘录如下,给有同样阅读全文
posted @ 2011-11-15 10:30 逐风流浪 阅读(69) 评论(0) 编辑