Archive for March, 2012
The application attempted to perform an operation not allowed by the security policy – DirectoryServices
Posted by Rajanihanth in Active Directory, DirectoryServices, SharePoint 2007 on March 23, 2012
I have developed a custom search and successfully deployed in our SharePoint 2007 (We have almost 16 sites and one document library, so we decided to filter the search according to the location, I will post the step by step development to the custom search later :)). My manager asked me to pick the location (ie. Organizational Unit (OU)) from Active Directory (AD) according to the user dynamically and I have written a method to pick the OU, you can see the post here. So far I didn’t get any problem but when I tried to deploy the web part to the SharePoint, I have got several errors and I managed to solve them but the following error gave me very hard time.
Security Exception: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application’s trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the permission of type ‘System.DirectoryServices.DirectoryServicesPermission, System.DirectoryServices, Version=188.8.131.52, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ failed.
I tried several solutions to fix this issue but no luck, because my C# code is trying to access the AD information which is in the different server, so there is no trusted permission from SharePoint, but I could access the details form the local machine. Finally I just read the error message carefully and modified the Trust Level in the SharePoint web.config to “Full” then it was working.
Please note: Changing this Trust Level might harm your SharePoint Security!
To do the changes:
Step1: Open the web.config file (Using Notepad OR Visual Studio)
Step2: Locate the <trust level=”WSS_Minimal” originUrl=”” /> tag in the web. config file. The default value is “WSS_Minimal”. I tried “WSS_Medium” but it didn’t solve the problem, sometimes it will solve yours.
Step3: Change the <trust level=”Full” originUrl=”” />
That’s all, it is working now. Happy coding n SharePointing! There are some other solutions for this related issue, you can try.
1. Changes on the .NET Framework 2.0 Configuration tool, Tim Huffam’s blog will show how to do the work around.
SharePoint search is not working, after moving the sites and the databases to the new servers
Posted by Rajanihanth in SharePoint 2007 on March 23, 2012
Recently we have moved our SharePoint intranet environment (MOSS 2007 and SQL 2005) to the new servers (Medium farm) because of the performance related issues. After moving the databases and sites, our team was doing some testing. I was trying to search a document and I didn’t get any results even we have done search setup and crawling already. 😦
One of my friends, who sent me this useful link which suggests the reliable search deployment! After configuring few additional set-ups including some Regedit (Windows Registry) modification, the search is working perfectly. YaY!
How to remove a corrupted WebPart from a page in SharePoint 2007
Posted by Rajanihanth in SharePoint 2007, Webpart on March 10, 2012
When I was playing with custom WebParts in SharePoint 2007, I used to getting an error message saying “An unexpected error has occurred“ and I could not navigate to the previous page again! Because SharePoint stores all the .aspx pages directly to the database, so when a corrupted WebPart added to the page we cannot access them!
Add a custom WebPart to the SharePoint page:
So you need to delete this corrupted WebPart to navigate to the page again. There might be several way to solve this issue, but following is an easy way to delete the WebPart! Here you go 🙂
Step 1: Just type “?contents=1” in the address bar to the end of the url and Press <Enter>.
You will be navigating to the following Web Part Page Maintenance page.
Step 2: Select the WebPart which you want to delete (OR whatever you want to do) and click delete link button on the top. That’s all you are able to navigate to the page without any issue!
Please note: If you change any other WebPart in the Web Part Page Maintenance page, it will be affecting all other users who have access this page!
WSP Builder Error 1 – Microsoft SharePoint Services Timer is not running on ”Server Name”
Posted by Rajanihanth in SharePoint 2007, Webpart, WSP Builder on March 7, 2012
I was developing a Webpart using WSPBuilder (SharePoint WSP tool) in my new development server (SharePoint 2007, Visual Studio 2008 and Windows 2008 R2) and was trying to deploy the solution then I have got the following error message!
I have checked the “Windows SharePoint Services Timer” on the Windows Services and it was running! I tried to re-build and re-deploy the solution again and I have got the same error message again. 😦
Start –> Administrative Tools –> Services
After spending several minutes and I have found the solution here!
If we want to deploy a solution using WSPBuilder, it needs the Administrative privileges, so we need to run the Visual Studio as Administrator.
That’s it, I was able to deploy the Webpart successfully!