Cannot create Content Database with Domain Account , Installing MOSS.

It took almost a day to install MOSS on my machine. Previously, I had SharePoint 2010 server on my machine , then I switched to MOSS as it was requirement.
In nut shell , Every time it continued failing on step 2 ‘Cannot create content database’.
In logs there was nothing special, I was using domain account and it already had all the required rights for MOSS as same user was running SharePoint 2010 server.

After googling so many blogs , I red a statement ‘ if you have Microsoft Office Installed then un-Install it’.
I thought to give it a try as except this every thing ‘rights and permissions ‘ were as expected.

I un-installed the Microsoft office and ran ‘SharePoint Products and Technologies Configuration Wizard’. You know what ?

It worked as a charm without any error Smile.

So It is good to install Microsoft Office after SharePoint Smile.


Set App Pool Identity from Central Administration.

Today going through different tasks a situation arises where I had to set the app pool identity from central administration. Its important to mention that I have SharePoint 2010 Server deployed on my local machine. Setting Identity from IIS , then to web applications and then to advance settings and identity was a task which was in routine but to set it from Central Administration was a new one.

“Every thing whether small or big , if it gives you opportunity to learn something is great.

That was new thing for me , so I googled Smile. Some were showing commands and some were saying its not there.
Finally in a post , sorry as I just missed the Url of that, I found the solution. Its so simple and worth sharing for those who are now familiar with it.

Following are the steps to set app pool identity from central administration

  1. Open Central Administration.
  2. In Security Section click onto Configure Service Accounts.
  3. Now select the app pool of which you need to change the identity.
  4. then click on Register New Managed Accounts.
  5. Here provide the username and password.
  6. After its been successfully applied.
  7. Reset IIS.

Congratulations , You have learned a new thing today Smile.

Regards
Kazim.


Getting the Version of SharePoint Installed

I am not discussing about something which seems to be rocket science , Though ,being through many blogs , i saw some people are getting these things from system registry. But what if the system is upgraded with SharePoint 2010 and previously MOSS was installed ?.

The easiest way to get the installed version , whether it is WSS , SharePoint Foundation , MOSS or SharePoint 2010.

You need to add the SharePoint assembly reference first.

using Microsoft.SharePoint;

using Microsoft.SharePoint.Administration;

Then simplest way to get the version in.

string SharePointVersion = SPFarm.Local.BuildVersion.ToString();

Happy coding :)


Troubleshooting with Asynchronous post back errors or Error occurred in Ajax control toolkit.

Its often hard to identify the error occurred in scripts , specially with asynchronous post backs and Ajax update panel.

A good and affective way to identify is described by Mr. Aqeel (An experienced SharePoint developer) to me and i am very glad write it here.

ScriptManager.GetCurrent(this.Page).AsyncPostBackError += new EventHandler<AsyncPostBackErrorEventArgs>(UC_AsyncPostBackError);

I have user control which populates the data and some scripts are being attached to it.

so declared the event  AsyncPostBackError in page load of that user control.

Then into the even of AsyncPostBackError.

void UC_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e)
      {
          try
          {
              string exc = e.Exception.Message;
          }
          catch (Exception ex)
          {

              throw;
          }
      }

This would let you know the exact exception occurred.


Deploying custom timer job on SharePoint farm – Troubleshooting

I was working on SharePoint timer jobs and was stuck into it.

Scenario :

We have web app level feature having timer job which runs on all the server in farm.
I changed few logic’s in custom timer job code. New logic is running only on One of three server. (App,WFE1,WFE2).
I deployed the solution on app server using wsp builder and stsadm commands.

Solution :

copying the solution from http://www.codeproject.com/KB/sharepoint/debugging-sharepointjobs.aspx

Cached Assemblies!

Any time you update your custom timer job class and deploy the assembly to the global assembly cache, you must restart all the timer services in the farm. If you don’t restart the timer service, it will run the old copy of your timer job class. Yes, the timer service caches the assemblies. Restarting the SharePoint timer service is the only way to refresh the assembly cache and force it to use your updated assembly.

After restarting OWS Timer service on all servers , it worked out for me :) HuRraY..

Special thanks to Mr. Shoaib Adil for assisting me.


Reset values of all controls in form/ASP.Net page using C#

Today i am going to blog a post which is not a rocket science , well there is no rocket science ever posted from my side :)

I was lying in my blanket , enjoying cozy winter using the laptop , when friend of mine asked ‘what if we need to clear the values of all controls on form to defaults’.

That was not a tough question , more then tough it’s interesting as there are many scenarios in which we need to give default values to the controls on web or form in single click.

foreach is the key loop in that.

So lets start exploring this query.

Initially a form with following controls is designed.

frmMain

  • Check Box : name is chkBox
  • Radio Button : name is rbtn
  • Text Box : name is txtBox
  • Drop Down : name is cmbBox
  • Button : name is btnReset

Now requirement is to set the default values to all the controls on the form or web. Right now i am going with form.

Few controls are being used to make it more easy to understand.
Here comes the code for that on btnReset_Click

private void btnReset_Click(object sender, EventArgs e)

       {

           foreach (Control c in this.Controls)

           {

               switch (c.GetType().ToString())

               {

                   case "System.Windows.Forms.TextBox":

                       ((TextBox)c).Text = string.Empty;

                       break;

                   case "System.Windows.Forms.ComboBox":

                       ((ComboBox)c).SelectedIndex = 1;

                       break;

                   case "System.Windows.Forms.CheckBox":

                       ((CheckBox)c).Checked = false;

                       break;

                   case "System.Windows.Forms.RadioButton":

                       ((RadioButton)c).Checked = false;

                       break;

               }

           }

       }

I have assigned the default values in Switch statement.

frmMain

In case of web page , class representing text box “System.Windows.Forms.TextBox” would have been “System.Web.UI.WebControls.TextBox”

 

Happy coding :) .


How to Unlock ports in FireFox ?

 

Follow the steps to make your life easier :)

  • Type about:config in address bar of firefox

aboutconfig

  • Search for network.security.ports.banned.override
  • If that is not in that , don’t worry , lets create it
  • Right click and select the following options shown in image, New –> String

aboutconfig

  • write network.security.ports.banned.override
  • then double click that string and enter the port number which you want to be un banned.
  • I want it to be ‘111’ as i have installed SharePoint Central Administration on that port.
  • press ok and enjoy the open port :)

How to increase debugging time of SharePoint sites using iis7

Debugging is always life saving drug for developers :) But its so annoying when SharePoint developer is in state of debugging and suddenly Giant Annoying Message appears that

iis

Solution to this annoying thing is to increase the debugging time, so here is the simple procedure

  • Open IIS7 Manager.
  • Select the App Pool on which site you want to debug is hosted.
  • Go to its Advance settings from the Actions Panel ‘ Right most  side’.
  • Under the ‘Process Model’.
  • Change ‘Ping enabled to ‘false’’.
  • Maximum Response time (Seconds) : from 30 to 999999

Increase Debug Time

Press OK and enjoy :)


How to change User Password from Command Prompt

Hi ,

I had a chance to change the password of Windows Server 2008 administrator account , which has been used in SharePoint , SQL server , Domain and many other. Which meant a lot as Windows was not accepting the old password as new one and i had to give it the same password which i was using already as new password.

So the command which helped me is as follows.

net user user_name  new_password  and


Creating custom group for SharePoint web parts programmatically

In last blog i discussed how to create new group / custom group or category for SharePoint web part(s).
Into this will discuss how to create the group / category programmatically.

For that purpose i have created a feature and in feature reciever (.cs) code is being applied when feature is activated.

//Getting the url of home site of site current site collection

using (SPSite aSite = new SPSite(SPContext.Current.Site.Url))
                {
                    using (SPWeb aWeb = aSite.OpenWeb())
                    {

// Getting the web part gallery into galleryList object of SPList

                        SPList galleryList = aWeb.Lists["Web Part Gallery"];

                        foreach (SPListItem anItem in galleryList.Items)
                        {
// There could have been many items into that gallery with properties null or no properties – check for them , as custom web part would have property [“WebPartTypeName”]

                            if (anItem.Properties != null && anItem.Properties.Count > 0)
                            {
// Check whether an item contains right properties , i am using name space to locate the right property as web part name can be changed by administrator but not the name space name as that would have been deployed by the developer.
                                if (anItem.Properties["WebPartTypeName"].ToString().ToLower().Contains(“mycustomwebpart[name space]“))
                                {
                                       anItem["Group"] = “My Custom Group”;
                                       anItem["Description"] = anItem.Title + ” This is description of my custom web part”;
                                        anItem.Update();
                                  }
                            }
                        }
                    }

 

After that all the web parts comprising that name space would be added to “My Custom Group” with description.

Happy Coding.


Follow

Get every new post delivered to your Inbox.