Wednesday, August 11, 2010

Changing domain password Programmatically

I was writing a web utility to change the domain password of the user. Here, the user required to enter the current password and the new password.


First error I was encountered - "The password does not meet the password policy requirements. Check the minimum password length, password complexity and password history requirements. (Exception from HRESULT: 0x800708C5)"


Initially I thought that, there is a problem in password strength, so I try may combinations to create the most complex password in the world! But getting the same error.


After doing some research on the internet I found that, "Minimum Password Age" setting needs to set to 0, to allow users set the password many times a day. The default value is 1.





Following are the code snippet used for changing password:

               string Username = strAccountName.Substring(strAccountName.LastIndexOf(@"\") + 1); //Getting account name from the parent application, "Rocky\\Soumyendra"
                string newpwd = txtNewPass.Text;
                string oldpwd = txtOldPass.Text;

                SPSecurity.RunWithElevatedPrivileges(delegate
                {
                    PrincipalContext principalContext = null;
                    principalContext = new PrincipalContext(ContextType.Domain, domain);
                 
                    UserPrincipal user = UserPrincipal.FindByIdentity(principalContext, Username);

                    if (user != null)
                    {

                        user.ChangePassword(oldpwd, newpwd);
                        user.Enabled = true;//By default User is Disabled in Domain
                        user.Save();

                    }
                });
                SendEmail(newpwd);




Friday, July 30, 2010

Embedding YouTube video on a SharePoint site

On the particular day, Client requested to show a YouTube video on a SharePoint site. I did a quick research and followed these steps:


On the SharePoint Site, add a 'Content Editor Webpart'. 


Next, choose 'Source Editor' from the right pane.
Now, go back to the YouTube site and find the video you want to add on the SharePoint Site. There is an Embedded button on the YouTube site, click on that to get the Embedded codes.



Now, Copy these embedded codes.


Open the Source Editor, and paste the already copied text, Save, apply and OK. 




That's all guys!!!

Monday, July 26, 2010

Fixing issue "Your queue job CreateWssSite failed. Please contact your administrator for assistance"

While working on the Microsoft Project Server 2007, you might encounter an issue "Your queue job CreateWssSite failed. Please contact your administrator for assistance" This error shows in an email and normally sent to the Administrator. 


The root cause of this error is, when you are publishing a Project from the Microsoft Project Professional, the Project Workspace URL is asked. There are several validation associated with this workspace URL, like Total length, invalid characters etc. Now, when you are trying to publish your project programmatically, the above mention error showed.


On the Project Server you can view the project workspace URL the following way:







Please use the following setting in the "Project Workspace Provisioning Settings". This setting will stop creating project workspace as soon as you published a project. Now user create the project workspace site manually if he got the permission. 





Tuesday, July 13, 2010

Converting office documents into a web page in SharePoint

While working on SharePoint I was looking a facility to see the uploaded documents as a web page. Then the users does not require a sophisticated office system only to view the documents.


Steps:


1) Go to Central Administration - > Operations - > Services on the Server page.

  • "Document Conversions Launcher Service"
  • "Document Conversions Load Balancer Service" should be Started.





2) Central Administration -> Application Management -> Document Conversation




3) Select the site where you want to use the Document Conversion service and Click on OK.
Please note that, this service only works on a "Publishing Site".




4) Now, go back to your site where the Document Conversion service is enabled. Hover on a document, then select "Convert Document" next, "From Word Document to Web Page". 




5) Specify the Title and URL




6) Following page shows if any errors/warning occurs at the time of conversion.




7) View the document as a web page






Limitation:

  • This service only works in a Publishing Site
  • Converts only Office 2007 documents, does not support .doc files
  • Sometimes images does not show properly on the web page.
  • Does not work if MOSS is installed on a Domain Controller.

Monday, June 28, 2010

Project Server Backup and Restore

Backup:

Step 1: Create the Backup location
 













Step 2: From the “Central Administration” click on “Perform a backup”
 

Step 3: Select “Farm” option and click on “Continue to Backup option”

Step 4: Specify the backup location and type as “Full”

Step 5: Wait for the entire “In Progress” task to be completed

Step 6: Check the creation of backup file.
 



Restore Process:
Step 1: From the Central Administration, Operations, and click on “Restore from backup”


Step 2: Specify the backup location
 
  Step 3: Select the backup and click on “Continue Restore Process”

Step 4: Next, select “NetappSharedService” from the selection, as we are restoring only the Project Server specific data. Click on “Continue Restore Process”

Step 5: Select “Same configuration” and ignore the warning message
 

Step 6: Provide the password for database access

 Step 7: Please wait for “In progress” and “Not started” tasks to be finished.

Step 8: verify the PWA site for all the data and configuration restored or not.

Wednesday, June 9, 2010

Project Server Site (PWA) cannot be edited using SharePoint Designer

While developing on the Project Server (PWA) , I got a requirement to change some design (UI) of the site. Therefor I tried opening the site with the SharePoint Designer (SPD). But to my surprise I got the following message.


After doing some research I learnt that, on the site definition level, Microsoft disabled the editing in SPD. On the "ONET.xml" file the following key does the disabling act.







Now,the tricky part is if you remove this key on the site definition file, there is a huge possibility that your site might break and Microsoft does not recommend this modification on the ONET.xml file.

DisableWebDesignFeatures="wdfopensite"



This discussion thread has some more details. 

Re-publish an InfoPath Template to an existing list

Recently I made a goofed-up in a SharePoint list where an InfoPath form was published. As we all know that, if we publish an InfoPath form to a library, the next time onwards the publishing wizard remember everything and you only have to click next.


But when I try to re-published a similar template from a different site to an existing library, the metadata of that list are gone. Also I have figure out that the internal names of  "Promoted Properties" are also changed. Say, earlier we have a field called "Request" now it becomes "Request1".


To avoid these type of problem, you need to map the column when published.