MOSS爬网问题Error from SharePoint site: Data is Null. This method or property cannot be called on Null values
来源:互联网 发布:武汉黄陂公安局网络 编辑:程序博客网 时间:2024/06/14 06:36
最近做一个MOSS项目,出现一个爬网问题,从爬网日志中返回如下错误:Error from SharePoint site: Data is Null. This method or property cannot be called on Null values。
解决方法,MOSS站点中的组描述值不能为空,否则会报上述错误。可以使用代码更新SPGroup.Description值,但是如果用一个组添加成功后再用代码来修改SPGroup.Description 时在网站上看到改组的描述是没有变化的,还是很以前一样,如果在页面修改了该组的描述再代码中跟踪通过SPGroup.Description 来查看也是没变化的。在MSDN中到了了相关描述详见
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spgroup.aspx
具体说来就是,用户组中的描述是存储在网站集跟站点下的“用户信息列表”中有一个“描述”的栏。用户信息列表中存储了该站点集下所有的用户和用户组相关一些信息描述。感兴趣可以用 U2U CAML Query Builder 来查看其中的内容和信息。
修改描述信息方法如下:
using (SPSite oSite = new SPSite("http://moss:9001"))
{
using (SPWeb oWeb = oSite.OpenWeb())
{
SPList userInfomationList = oWeb.Lists["用户信息列表"];
SPGroupCollection oGroupColl = oWeb.SiteGroups;
foreach (SPGroup group in oGroupColl)
{
group.Description = group.Name;
group.Update();
SPQuery groupQuery = new SPQuery();
groupQuery.Query = string.Format("<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>{0}</Value></Eq></Where>", group.ID.ToString());
SPListItemCollection items = userInfomationList.GetItems(groupQuery);
if ((items != null) && (items.Count == 1))
{
items[0]["描述"] = group.Description;
items[0].Update();
}
}
}
}
}
- MOSS爬网问题Error from SharePoint site: Data is Null. This method or property cannot be called on Null values
- Data is Null. This method or property cannot be called on Null values.错误分析
- Property or field 'LevelName' cannot be found on null
- 解决arraycollection赋值修改过程中,出现TypeError: Error #1009: Cannot access a property or method of a null obje
- future method cannot be called from a future or batch method
- Gradle error:cannot invoke method buildToolVersion on null object
- 【问题集】Error Cannot read property 'globals' of null
- "Resources cannot be null" 问题
- SharePoint 2013 Error - TypeError: Unable to get property 'replace' of undefined or null reference
- jQuery on IE8, error: Object doesn't support this property or method
- Resources cannot be null
- Resources cannot be null
- Resources cannot be null
- Resources cannot be null
- Resources cannot be null
- WebView Exception Uncaught TypeError: Cannot set property 'from' of null
- laravel redis 扩展冲突的问题分析:Fatal error: Non-static method Redis::keys() cannot be called statically
- mybatis映射问题,报错Error instantiating null with invalid types () or values (). Cause:java.lang.NullPoint
- C#.NET页面跳转+js
- 不修改IIS设置,在IIS6下运行MVC架构的网站
- org.codehaus.xfire.fault.XFireFault: Parameter {http://xxx.xxx}method(方法) does not exist!异常
- Oracle中的游标
- 一个关于文件写入时乱码的故事
- MOSS爬网问题Error from SharePoint site: Data is Null. This method or property cannot be called on Null values
- 如何面对自己
- 引用
- 八大排序算法总结
- windows_批处理指令_chm手册下载
- 父类不能赋值给子类的猜想。
- windows_脚本语言_chm手册下载
- (转)Win2003上SVN无法使用解决方案
- Filter全局解决中文乱码问题