Moss 2007 的几个编程技巧
1、提升权限执行的代码 SPSecurity.RunWithElevatedPrivileges(delegate() { // 需要提升权限执行的代码 }); 应用场景:当前用户可能没有权限执行的操作,但系统需要执行这段代码,这样如果不提升代码权限的话. 系统将会报出 拒绝访问错误. 用上述代码可以
1、提升权限执行的代码
SPSecurity.RunWithElevatedPrivileges(delegate()
{
// 需要提升权限执行的代码
});
应用场景:当前用户可能没有权限执行的操作,但系统需要执行这段代码,这样如果不提升代码权限的话.
系统将会报出 拒绝访问错误.
用上述代码可以将其所辖范围内的代码权限提升到最高.
建议:不到万不得以不要使用,因为滥用会把系统的权限搞混.
2、解决一个或多个域类型未正确安装。请转到列表设置页删除这些域
sharepoint列表内部字段的查看方法
SPQuery查询列表查不出结果,提示“一个或多个域类型未正确安装。请转到列表设置页删除这些域”。
原因:
查询的时候,字段名称需要输入字段的内部名称,而不是看到的那个名称
解决方法:
我写了段代码可以把字段以及对应的内部名称列出来,查一下就可以了。
protected void Button2_Click(object sender, EventArgs e)
{
SPWeb site = SPControl.GetContextWeb(Context);
SPListItemCollection items = site.Lists["测试列表1"].Items;
string tmpstr = "";
SPListItem item = items[0];
for (int i = 1; i {
tmpstr = tmpstr+item.Fields[i].ToString()+":" + item.Fields[i].InternalName.ToString()+"
";
}
tmpstr = tmpstr + "
";
Label1.Text = tmpstr;
}
3、解决代码引发 Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem 安全性驗證無效
在更新语句前
加上:
myWeb.AllowUnsafeUpdates = true;//该代码表示允许代码更新

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

It allows users to perform more in-depth operations and customization of the system. Root permission is an administrator permission in the Android system. Obtaining root privileges usually requires a series of tedious steps, which may not be very friendly to ordinary users, however. By enabling root permissions with one click, this article will introduce a simple and effective method to help users easily obtain system permissions. Understand the importance and risks of root permissions and have greater freedom. Root permissions allow users to fully control the mobile phone system. Strengthen security controls, customize themes, and users can delete pre-installed applications. For example, accidentally deleting system files causing system crashes, excessive use of root privileges, and inadvertent installation of malware are also risky, however. Before using root privileges

What to do with blue screen code 0x0000001? The blue screen error is a warning mechanism when there is a problem with the computer system or hardware. Code 0x0000001 usually indicates a hardware or driver failure. When users suddenly encounter a blue screen error while using their computer, they may feel panicked and at a loss. Fortunately, most blue screen errors can be troubleshooted and dealt with with a few simple steps. This article will introduce readers to some methods to solve the blue screen error code 0x0000001. First, when encountering a blue screen error, we can try to restart

An ISO file is a common disc image file format that is typically used to store the entire contents of a disc, including files and file systems. When we need to access the contents of the ISO file, we need to decompress it. This article will introduce several common methods to decompress ISO files. Decompression using a virtual optical drive This is one of the most common methods of decompressing ISO files. First, we need to install a virtual optical drive software, such as DAEMON Tools Lite, PowerISO, etc. Then, double-click the virtual optical drive software icon

Termination Code 0xc000007b While using your computer, you sometimes encounter various problems and error codes. Among them, the termination code is the most disturbing, especially the termination code 0xc000007b. This code indicates that an application cannot start properly, causing inconvenience to the user. First, let’s understand the meaning of termination code 0xc000007b. This code is a Windows operating system error code that usually occurs when a 32-bit application tries to run on a 64-bit operating system. It means it should

How to set permission access in QQ space? You can set permission access in QQ space, but most friends don’t know how to set permission access in QQ space. Next is the diagram of how to set permission access in QQ space brought by the editor for users. Text tutorial, interested users come and take a look! QQ usage tutorial QQ space how to set permission access 1. First open the QQ application, click [Avatar] in the upper left corner of the main page; 2. Then expand the personal information area on the left and click the [Settings] function in the lower left corner; 3. Enter the settings page Swipe to find the [Privacy] option; 4. Next in the privacy interface, select the [Permission Settings] service; 5. Then challenge to the latest page and select [Space Dynamics]; 6. Set up in QQ Space again

If you need to program any device remotely, this article will help you. We will share the top GE universal remote codes for programming any device. What is a GE remote control? GEUniversalRemote is a remote control that can be used to control multiple devices such as smart TVs, LG, Vizio, Sony, Blu-ray, DVD, DVR, Roku, AppleTV, streaming media players and more. GEUniversal remote controls come in various models with different features and functions. GEUniversalRemote can control up to four devices. Top Universal Remote Codes to Program on Any Device GE remotes come with a set of codes that allow them to work with different devices. you may

What does the 0x000000d1 blue screen code mean? In recent years, with the popularization of computers and the rapid development of the Internet, the stability and security issues of the operating system have become increasingly prominent. A common problem is blue screen errors, code 0x000000d1 is one of them. A blue screen error, or "Blue Screen of Death," is a condition that occurs when a computer experiences a severe system failure. When the system cannot recover from the error, the Windows operating system displays a blue screen with the error code on the screen. These error codes

The characters in Love and Deep Sky have various numerical attributes. Each attribute in the game has its own specific role, and the critical hit rate attribute will affect the damage of the character, which can be said to be a very important attribute. , and the following is the method to improve this attribute, so players who want to know can take a look. Method 1. Core method for increasing the critical hit rate of Love and Deep Space. To achieve a critical hit rate of 80%, the key lies in the sum of the critical hit attributes of the six cards in your hand. Selection of Corona Cards: When selecting two Corona Cards, make sure that at least one of their core α and core β sub-attribute entries is a critical hit attribute. Advantages of the Lunar Corona Card: Not only do the Lunar Corona cards include critical hit in their basic attributes, but when they reach level 60 and have not broken through, each card can provide 4.1% of the critical hit.
