惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Help Net Security
Help Net Security
G
Google Developers Blog
雷峰网
雷峰网
WordPress大学
WordPress大学
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Engineering at Meta
Engineering at Meta
Security Latest
Security Latest
T
Threat Research - Cisco Blogs
AWS News Blog
AWS News Blog
F
Full Disclosure
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Exploit Database - CXSecurity.com
J
Java Code Geeks
U
Unit 42
C
Cyber Attacks, Cyber Crime and Cyber Security
V
V2EX
C
Cisco Blogs
博客园 - 司徒正美
Project Zero
Project Zero
L
LINUX DO - 热门话题
阮一峰的网络日志
阮一峰的网络日志
Blog — PlanetScale
Blog — PlanetScale
Scott Helme
Scott Helme
A
About on SuperTechFans
Hugging Face - Blog
Hugging Face - Blog
S
Securelist
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏
S
Schneier on Security
G
GRAHAM CLULEY
酷 壳 – CoolShell
酷 壳 – CoolShell
Cyberwarzone
Cyberwarzone
MongoDB | Blog
MongoDB | Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 叶小钗
T
Threatpost
Recorded Future
Recorded Future
C
CXSECURITY Database RSS Feed - CXSecurity.com
宝玉的分享
宝玉的分享
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
The Register - Security
The Register - Security
S
Security Archives - TechRepublic
博客园 - Franky
N
News | PayPal Newsroom
Simon Willison's Weblog
Simon Willison's Weblog
S
SegmentFault 最新的问题
W
WeLiveSecurity
A
Arctic Wolf
B
Blog

博客园 - heli猫

修改infopath样式的小技巧(如何让文本框自适应文字多少?) 我在ABC公司的第一个项目 -- 编了个小故事,讲讲我理解的软件生命周期模型 用js调用ActiveX发outlook的meeting request的方法 - heli猫 - 博客园 如何解决带托管代码的infopath表单上传中的“正在删除”问题 通过代码 操作 sharepoint 讨论版 (转) - heli猫 IT项目经理经验谈 - 如何谈判 WSS、SharePoint 2003、MOSS、SharePoint 2009 大比对(5) WSS、SharePoint 2003、MOSS、SharePoint 2009 大比对(4) WSS、SharePoint 2003、MOSS、SharePoint 2009 大比对(3) WSS、SharePoint 2003、MOSS、SharePoint 2009 大比对(2) WSS、SharePoint 2003、MOSS、SharePoint 2009 大比对(1) MOSS数据库扩展设计方案 MOSS和其他系统的数据集成方式 MOSS站点的优化方案(结合kaneboy的文档) SharePoint应用场景介绍(一) 推荐一篇有用文章:创建Feature扩展SharePoint列表项或文档的操作菜单项 在两个不信任的域或两台独立服务器中安装SharePoint MOSS母版页制作学习笔记(二) MOSS母版页制作学习笔记(一)
对象的当前状态使该操作无效 or SPListItem Update Operation is not valid due to the current state of the object
heli猫 · 2008-10-15 · via 博客园 - heli猫

在提升权限后对MOSS的list的字段进行更新,出现:对象的当前状态使该操作无效

SPSecurity.RunWithElevatedPrivileges,这个是需要在new SPSite(...)的时候才会去提升权限, 提升的权限是对SPSite, SPWeb的

SPSecurity.RunWithElevatedPrivileges(delegate()
        {
           
using (SPSite site = new SPSite("http://localhost"))
            {
               
using (SPWeb web = site.OpenWeb())
                {

                  。。。

                  }

            }

         });

改为:
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPSite site = new SPSite("http://localhost/")
SPWeb web = site.OpenWeb()
});
SPList list = web.Lists["字段名"];
SPListItemCollection items = list.Items;
。。。。
item.Update();

就可以了