Tuesday, June 7, 2011

Execute code after Asynchronous postbacks

When we use ASP.NET UpdatePanel in our application and do postbacks, it results asynchronous postbacks from controls inside UpdatePanel which don’t trigger window.load() or jQuery’s $(document).ready() methods. To run a method after asynchronous postback, we need to use Sys.WebForms.PageRequestManager. It has add_endRequest() method which allows to attach method to this event which will run after asynchronous postbacks.
To do this, add these lines in your javascript code.
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(loadText);

function loadText() {

// Add your code which will run after Asynchronous postback.

}

If you are doing something on window.load() or $(document).ready() event and want to execute it after postbacks from controls residing inside UpdatePanel, copy that in your asynchronous postback event handler(s) as well.

For attaching a method with Page Load event, we can use

Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(eventHandler);

Monday, March 21, 2011

“The language of this installation package is not supported by your system.”, Error while installing SharePoint 2010 on Windows 7.

Today, I was setting my development environment up on Windows 7 and was following this blog post for installing SharePoint 2010 on Windows 7. After extracting SharePointServer.exe for modifying config.xml to allow SharePoint setup on client OS, when I ran setup.exe, it gave me this error. “The language of this installation package is not supported by your system.”

2011-03-20_1915

I extracted SharePointServer.exe using WinRar and it created 156 items in SharePointServer folder.

4

However, when I extracted SharePointServer.exe in command line using extract switch, it created 30 items in SPFiles folder. Then it worked perfect and now I am running a fine installation of SharePoint 2010 on Windows 7.

Here C:\ is location where SharePointServer.exe is located and C:\SPFles is destination folder where files got extracted. So command is SharePointserver /extract:C:\SPFiles.

1

2

3

Saturday, March 5, 2011

Check if Web Application exists using PowerShell in SharePoint

To check if a web application exists in SharePoint environment using PowerShell, use this script.

Add-PsSnapin Microsoft.SharePoint.PowerShell

[void][System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”)

$WebAppName = "IntranetPortal80"
$sp = Get-SPWebApplication | Where {$_.DisplayName -eq $WebAppName}
if($sp -eq $null)
{

        Write-host "Null"
}
else
{
        write-host "No Null"
}

In, if-else block do what you want to do.

Wednesday, January 26, 2011

Get list of all users of a SharePoint Web Application using PowerShell

To get a list of all users of a SharePoint web application in PowerShell, we can use get-spuser cmdlet. This cmdlet should be used with SPWeb object.

To get all users in a web application use this PowerShell command. It will include all users in all site collections of web application.

Get-SPWebApplication http://sp2010:2000 | Get-SPSite | Get-SPWeb | Get-SPUser

UserLogin                                DisplayName
---------                                  -----------
DS\expsah                              DS\expsah
SHAREPOINT\system               System Account
DS\expsah                              DS\expsah
NT AUTHORITY\auth...             NT AUTHORITY\auth
NT AUTHORITY\LOCA...            Salman Mn1 Ahmad
SHAREPOINT\system               System Account
DS\expsah                              DS\expsah
NT AUTHORITY\auth...             NT AUTHORITY\auth
NT AUTHORITY\LOCA...            Salman Mn1 Ahmad
SHAREPOINT\system               System Account
DS\expsah                              DS\expsah
NT AUTHORITY\auth...             NT AUTHORITY\auth
NT AUTHORITY\LOCA...            Salman Mn1 Ahmad
SHAREPOINT\system               System Account

Friday, January 7, 2011

SharePoint Saturday Lahore : Registrations Now Open!

clip_image002

As you may or may not be aware, for the first time there is a SharePoint Saturday event coming up in Lahore – Pakistan on the March 26th, 2011

It is with great pleasure that I announce to you that registrations for the first SharePoint Saturday Lahore are now open.

A great opportunity to connect with the SharePoint community of Pakistan,  we are planning on having some great sessions, speakers from SharePoint. Come and see a variety of speakers from all over Pakistan and the world.

To register to attend this event, please click here and fill out the details. This ensures your place and adequate catering for the event. The event is FREE to attend and we would love to have you there supporting the event, allowing us to put on more SharePoint Saturday events here in Lahore in the future.

The SharePoint Saturday Website is: http://www.sharepointsaturday.org/Lahore

Please follow @SPSLahore on Twitter, keep track of the #SPSLHE hash tag on Twitter and link with SPSLahore on Facebook to keep up to date with announcements.

For your queries, please contact the #SPSLahore committee by sending an email to spslahore[at]hotmail.com.

Thanks,