HTTP Service Is Too Busy Error!

An Error you may face is when you try to run a simple SharePoint Management Shell Command, it gives you an error saying :

The HTTP service located at http://localhost:(portNumber)/securitytokenserviceApplication/securitytoken.svc is too busy.

And no commands were working at all.

In this case check the Application Pool for the SecurityTokenServiceApplicationPool, you’ll notice it’s stopped, start it and try again.

Changing RSS Feed links Reference

If you used RSS feeds with SharePoint, and want to make a button where it will display an RSS for specific pages library, you will notice that title in the RSS will open the properties page for the page, not the page itself, so how to change the option?

Go to your “Pages” library, and click library settings in the ribbon, click on RSS settings, you will see a category called “Document options”, change the “Link RSS items directly to their files?” to yes

After changing this option, you’ll see the expected results.

Happy SharePointing

Managed MetaData Service Application Error

When you first install SharePoint and open Central Administration for the first time, you’ll be given two choices, either to run the configuration wizard and let SharePoint do the administrative tasks for you, or configure the farm yourself.

If you configure the farm yourself and decided to add the Managed Metadata Service, you would simply go to Application Management>> Manage Service Applications>> Click new and choose managed metadata service. The SharePoint will create the Service Application for you. So if you try to click on the Managed Metadata Service Application you will be presented with the following error:

The Managed Metadata Service or Connection is currently not available. The Application Pool or Managed Metadata Web Service may not have been started. Please Contact your Administrator.
To Solve this issue, go to Central Administration >> System Settings Tab>> Manage Services on server>> and notice the managed metadata web service, its not started by default. click start and go back to your service applications page and view your service application. Note you may need to wait fora minute so that the error will disappear and you can use the service application.

How to rename Add new item in lists.

There is a requirement that is requested so much to change the Add new item label in SharePoint lists to something meaningful. The good about these labels is that they have an ID that you can play with using JavaScript. Each of SharePoint lists has ID that is different from a list to another.

For the custom list you have the ID= idHomePageNewItem,  for document libraries it is = idHomePageNewDocument, you can know the exact ID using the IE developer tool or the Firebug in Firefox.

To change the label, use JavaScript, you get the ID of the anchor and change the innerText property. The code is like this:

 

document.getElementById(‘idHomePageNewItem’).innerText= “my new text”;

That’s it.

Configuration Failed – Failed to create sample data

I was trying to install SP Foundation on my Hyper-V machine, and I faced this problem:

createSampleData

After searching and searching online, some people mentioned activating services and trying to run the configuration wizard again, others mentioned navigating to Microsoft Office Servers folder, which doesn’t exist anymore in the RTM release of SP Foundation, but the same principle works for the RTM. All you need to do is to navigate to the following path:

c:Program FilesWindows SharePoint Services15.0Data, and you’ll find an Analytics folder with a GUIC appended to it. All you need is to share this folder.

Hope this helps someone out there as it took a while for me to resolve.

Hiding Custom Web Part If Returned Data Is Empty

In this article, I will show how to hide a web part if the returned data from SharePoint list is empty.

First thing, what I use to implement the look and feel of items inside my web part is a div tag that runs at server, as the following:

<div id=”ReturnedData” runat=”server” name=”ReturnedData”/>

That’s all good, when you get items inside your query, and loop through each item, you add in your C# code: ReturnedData.InnerHTML+= …., and you format the item as you want, I know you get the idea!

Now for the fun part of hiding your web part if the items count = 0, so if the items count = 0, the div won’t have any HTML inside, right? So we can catch that in JavaScript, like the following:

<scripttype=”text/javascript”>

function HideIfEmpty() {

var ReturnedData= document.getElementsByName(“ReturnedData”);

if (ReturnedData[0].innerHTML == “”) {

var chrome = ReturnedData[0].parentNode.parentNode.parentNode;

chrome.style.display =“none”;

}

}

_spBodyOnLoadFunctionNames.push(“HideIfEmpty”);

</script>

That’s it, but how have we done it?

The function HideIfEmpty gets the element by the name attribute, which is ReturnedData. It contains more than one element inside, the first element contains all the innerHTML, so we get the innerHTML by searching for the first element in the array; ReturnedData[0] if equals =”” then we don’t have any data returned.

Now we need to get a reference to the web part chrome element, which is an ancestor of the div ReturnedData, so we get it by navigating up in the hierarchy three times., then hide the chrome by executing: chrome.style.display=”none”, this is how we hide elements in JavaScript.

Note the _spBodyOnLoadFunctionNames(“HideIfEmpty”) is used to execute the function once we load the page, this is how you execute JavaScript functions on page load in SharePoint.

Hope it helps someone out there.

M . D

Writing timer job against Managed Metadata Service Application

Have you ever written a timer job in SharePoint to read from or writing to a term store in Managed Metadata, you might have done so and faced the error:

The current user has insufficient permissions to perform this operation

Even if you try to run the code with SPSecurity.RunWithElevatedPrivileges(), or with your own account from Visual Studio, it will still give you the same problem.

The thing is, that the timer job runs with its own service, which is “SharePoint 2010 Timer”, see the below image.

The user running this service has to have access to the term store administrators in Central Administration, see the image below:

Once permission is given here, you will start having access from your timer job to the managed metadata term store and create your desired term sets and terms.

Object reference exception when accessing farm properties

Here is a problem I had and it took me a while to know the reason behind it, it’s when you try to add a farm property using PowerShell, like this:

Now try to get the farm properties using the following command: $farm.properties, you will see the following result:

that’s great! You could get your property name and value without any problems, so now let’s try to get the farm property in code, shall we?

In visual studio type the following in your code:

String myProperty = SPFarm.Local.Properties[“MyFirstProperty”].ToString();

Baaaaaam, you will get: object reference not set to an instance of an object.

The reason is, although you can see the farm property in PowerShell when you type $farm.properties, you need to write the $farm.update() command after that in order to be able to use that property and to be visible in your code.

Hope this helps someone out there.

How to use integrated scripting environment in SharePoint 2010

You know you can use SharePoint 2010 management shell for writing cmdlets for SharePoint, but you can also use the ISE(Integrated Scripting Environment) which is a host in Windows Server 2008 used to write cmdlets for PowerShell.

First, You need to activate this host by clicking on server manager, then features>> Add Features >> Windows PowerShell Integrated Scripting Environment(ISE) and click to install.

Once you have the ISE on your server. Open it. If you try to type PowerShell cmdlets for SharePoint it won’t work, you need to direct the ISE to run PowerShell commands for SharePoint.

Type the following:

Add-PSSnapIn Microsoft.SharePoint.PowerShell

Now you can write cmdlets for SharePoint.  But note if you close the ISE and open it again, this connection with SharePoint will be removed.  So you need to call this command once the ISE opens each time, so how do you automate this?

Well, ISE has a profile inside windows server 2008. So you need to find this profile and enter the command inside it so each time the ISE opens it looks to the profile and looks up the command the command to connect to SharePoint.

Type $profile inside the ISE you will get a path to your profile, Ended with .ps1  like this :

C:UsersMyUserDocumentsWindowsPowerShellMicrosoft.PowerShellISE_profile.ps1

Try to type notepad $profile, this will open the profile, in case you found this error message in notepad…

you need to create a path to your profile as provided from the path given by the ISE. then create a text

A Note About Farm Administrator

A farm administrator can do anything in your SharePoint environment! and he is a member in a group called farm administrator, so let’s see who are the members of this group in SP 2010. By default there are 3 members in this group which are as the following:

 

1- The user the you specified in the identity of the SharePoint central administration application pool, if you open your IIS manager, and go to application pools and see the application pool that runs the central administration, you will see the account the you specified while running the SharePoint configuration wizard. this account is part of the Farm Administrators Group.

 

2- The local Administrator of the server that has SharePoint installed in it. but one important note i like to add. if you have Domain Controller on your server and installed SharePoint, you will notice that the local administrators group is gone. you will not find this option in your windows settings when you have domain controller installed your server.

3- As you have guessed it. The user that you used when you installed SharePoint. This user for sure will be part of Farm Administrator.

 

I Hope that this little note has helped you understanding the Farm Administrator group that you have been seeing all the time in SharePoint Central Administration.