Pages

Friday 13 July 2012

Specified method is not supported. sharepoint 2010 (SP1)delete site


Specified method is not supported. SharePoint delete site
My SharePoint Server was working fine, I have install SharePoint 2010 SP1 on It, After that I am getting the Above error while I am deleting the site from Site Action - >  Site Settings -> Site Action -> Delete this Site. I am using Farm admin user, and ran Browser with Administrative privileges, 

This is Error come due Pre-Configure Site with Sp1, Site data Base is Create before Sp1 Installation on SharePoint server.
Solution:
You can use Following PowerShell Commands to Upgrade its Configuration Database.
Get Configuration databases for all Sites.

Upgrade Site Database Providing id in Above Result. Run the Upgrade-SpcontentDatabase 
To Confirm Type Y, It will Start Upgrade process and will Show progress in Percentage.

After that Delete the Site from Site Action - >  Site Settings -> Site Action -> Delete this Site


Thursday 12 July 2012

Sharepoint designer 2010 , Create Custom List Forms With Asp.net Controls and Fields Validation


As SharePoint designer is no code solution for SharePoint, you can see there are list of all asp.net controls available in SharePoint designer,
I am looking to create new item Form using Custom asp.net controls
Step 1: Create List Named as “Contacts” (You can Use any Name) with following columns.
Title Single line of text
Address Multiple lines of text
E-Mail Single line of text
Step 2: Open SharePoint Site in SharePoint Designer
            Navigate to List and libraries; Select the List named as contacts.
            Select the List settings for Ribbon and then select List Form or you will find same option at
Right              
side in second group/panel Click New. And Give some appropriate name to page.
You can see below screen shot as well to follow the Steps
               
               
Step 3 : Edit page in advance mode

Now Delete the Email Address Field from Form ->

Now go to insert and select Asp.net Controls and Select Text Box Control.


Note its Id will be display and control is selected; now associate this control with SharePoint List Column.

After that Add asp.net regular Expression validation Control to validate the Email Address field.
Follow the same steps as Insert -> Asp.net -> Regular Expression Control.
Open its Properties Window or you can edit its properties in Source View. Properties to be set such as Control to Validate, Error Message, Set Focus, Regular expression etc. like I have select its email Address  Validation you can write you own by selecting Custom Option,
“{} “ these braces did not work in SharePoint , so you cannot use them in regular expression.

Now save it and Open it in browser.
Type invalid email address it will Show error message




Automatic Sharepoint 2010 Site Collection BackUP Script


You can Take Site collection backup Using SharePoint 2010 Central Administration.
Central Administration -> Backup And Restore -> Specify  Site Collection and path to save backup.
But Most simple way to Use Power Shell Command 

Backup-Spsite -identity  “SiteURL”  -Path “File Name With Path”.

this is Manual Process,  You can automate this Process using PowerShell and Windows Task Scheduler , This will automate your Back process.

Step 1: 
Open Note pad and Paste Below written Script in it , Also modify Function call According to your  Environment (SiteCollection Url, path and Initial/prefix of you FileName).

Add-PsSnapin Microsoft.SharePoint.Powershell –ErrorAction SilentlyContinue
Function BackupSite([string]$SiteURL,[string]$path,[string]$BackUpInitial)
{
$today=(Get-Date  -Format dd-MMMM-yyyy-"'Time'"-hh-mm)
backup-Spsite -identity $SiteURL -Path $path\$BackUpInitial-$today.bak
}
#Function Call – Replace Parameter according to you requirements.
BackupSite "http://sp2010/" "C:\Backups" "SP2010"

Step2 : Save this File as ps1 Extension  (MyScript.ps1)

Step 3: Add this Script you Windows Task Scheduler.
            Start -> Administrative Tools -> Task Scheduler - > Create Task.
            Specify Task Name, Specify User to Run this Task in General Tab,
            Specify Trigger Time (to Automatic Trigger this Task)
Specify Action in Action Tab. select Action to Start Program from Dropdown, Write     
Program/Script “powershell.exe” Or you can select path from Browse Button.
            Add Argument s Write the PS1 File Name with path. 
You can read More details about windows task scheduler at technet Article  
You can Run this this Task Manually To test it, Select the Task, right Click and Click RUN.

Wednesday 11 July 2012

SharePoint 2010 PowerShell Commands List

SharePoint 2010 PowerShell is very powerful Feature for SharePoint. It’s very easy and some time required for SharePoint administrator to work in PowerShell.
It’s very hard to remember all PowerShell command SharePoint.

Here is simplest way to get list of all command related to SharePoint .

That will show results in table format. 
get-command -PSSnapin "Microsoft.SharePoint.Powershell" | select name, definition | format-table 
That will show results in List format.  
get-command -PSSnapin "Microsoft.SharePoint.Powershell" | select name, definition | format-List 
you can save all Commands in Text File by adding -wrap > [path to save file] at end of above command
get-command -PSSnapin "Microsoft.SharePoint.Powershell" | select name, definition | format-List  > C:\Sharepointcmd.txt