Posts Tagged SharePoint 2007

How to remove a corrupted WebPart from a page in SharePoint 2007

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:

Unexpected error:

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!

R./

References: 

1. http://erichanes2008.blogspot.com/2011/10/remove-corrupted-web-parts-in.html

, , , , ,

1 Comment

WSP Builder Error 1 – Microsoft SharePoint Services Timer is not running on ”Server Name”

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!

References: 

1. http://social.msdn.microsoft.com/Forums/ar/sharepoint2010general/thread/74aff7aa-ea97-4317-a4ba-41566cbe020a

2. http://pbodev.wordpress.com/2010/01/05/microsoft-sharepoint-services-timer-is-not-running/#comment-57

3. http://madtechnology.wordpress.com/2008/06/24/wsp-builder-for-sharepoint-microsoft-sharepoint-services-timer-is-not-running-error/

, , , , ,

1 Comment

You do not have permissions to open this file on Excel Services OR Excel cannot load the workbook that you requested –SharePoint 2007

One of my colleagues sent an error message while using the development site of SharePoint 2007 in my office and I figured out the configuration of “Excel Calculation Services” was not done properly. It’s a very simple set-up, here we go:

1. Make sure that “Excel Services” (Actually “Excel Calculation Services”) is running. To check this out please do the following steps:

Central Administration –> Operations under “Topology and Services” click “Services on server” 

On the table below we can see the “Excel Calculation Services” is started. So it’s running 🙂

2. Make sure that, file access method of “Excel Services Settings” is using “Process Account”, instead of the Impersonation. To do this, follow these steps:

Go to Central Administration –> Home

On the left menu, under “Shared Services Administration” Select your “Shared Services” (for me SharedServices2 but default SharedServices1)

Under “Excel Services Settings” click the “Edit Excel Services Settings” 

Change the file access method to “Process Account”.

3. Finally make the following changes on the Trusted file locations under “Excel Services Settings”. Here are the steps:

Go to the “Shared Services” underExcel Services Settings” click the ”Trusted file locations”.

You will be navigating to the Excel Services Trusted File Locations page. Then click “Add Trusted File Location”.

In the Location pane, do the following:

– Address: In this field we can enter a Document library or full portal Url (I have given Document library path). Please note: Don’t use like http://server:1010/documentlibrary1/forms/default.aspx instead of http://server:1010/documentlibrary1

– Location Type: For this field we have to select the “Windows SharePoint Services” option

– Trust Children: Ensure whether we need to be trusted the child libraries or directories, here I selected “Children Trusted”

Then click OK, that’s all! It is working huh! 🙂

References:

1. http://www.eggheadcafe.com/community/sharepoint/69/10068914/you-do-not-have-permissions-to-open-this-file-on-excel-services.aspx

2. http://blogs.msdn.com/b/andreww/archive/2009/04/21/excel-services-setup-and-getting-started.aspx

, , , , , , , , ,

3 Comments

How to get the current user’s OU (Organizational Unit) from AD (Active Directory) – C#

There are so many ways to get the user details form AD (Active directory), but I wanted to get the current user’s OU (Organizational Unit) from Active directory. There is no any direct method to get the OU (Actually I could not find anything on the web, if anyone get an easy way to find-out please let me know). I am currently developing a Custom Search for SharePoint 2007 and according to the OU, I want to display the search results.

Here is the method I have created and most of the comments I have put in the code itself. I used Asp.net and C#.

public string GetOU(string username)
 {
 string result = string.Empty;
 using (HostingEnvironment.Impersonate())
 {
 //Getting the domain
 PrincipalContext yourDomain = new PrincipalContext(ContextType.Domain);

//Finding the user
 UserPrincipal user = UserPrincipal.FindByIdentity(yourDomain, username);

//If the user found
 if (user != null)
 {
 // Getting the DirectoryEntry
 DirectoryEntry directoryEntry = (user.GetUnderlyingObject() as DirectoryEntry);
 //if the directoryEntry is not null
 if (directoryEntry != null)
 {
 //Getting the directoryEntry's path and spliting with the "," character
 string[] directoryEntryPath = directoryEntry.Path.Split(',');
 //Getting the each items of the array and spliting again with the "=" character
 foreach (var splitedPath in directoryEntryPath)
 {
 string[] eleiments = splitedPath.Split('=');
 //If the 1st element of the array is "OU" string then get the 2dn element
 if (eleiments[0].Trim() == "OU")
 {
 result = username + "-" + eleiments[1].Trim();
 break;
 }
 }
 }
 }
 }
 return result;
 }

Please don’t forget to add the following references:

using System.Collections;
using System.DirectoryServices.AccountManagement;
using System.DirectoryServices;
using System.Security.Principal;

If you want to get the current user’s OU then you can call this method in the Page_Load event.

protected void Page_Load(object sender, EventArgs e)
{
string userName = Context.User.Identity.Name;
LabelOU.Text = GetOU(userName);
}

You will get the output like this:

Domain-Name\RajanihanthV
OU-Name
I hope this small C# code will be helping someone! Thanks R./

References:

1. http://stackoverflow.com/questions/637486/how-to-get-the-current-users-active-directory-details-in-c-sharp

2. http://stackoverflow.com/questions/5309988/how-to-get-the-groups-of-a-user-in-active-directory-c-asp-net

, , , , , , , , , , , ,

7 Comments

Contributor Mode settings on SharePoint Designer

When I try to edit the HTML page (for Pageviewer Webpart in MOSS 2007) using the SharePoint designer, I didn’t see the HTML code at all and only see the design! The title bar shows “Contributor Mode” to the end. Read the rest of this entry »

, , , , , , ,

2 Comments