SharePoint Password Recovery

Below is the powershell Script to recover SharePoint passwords.
&$env:windir\system32\inetsrv\appcmd.exe list apppool "SharePoint Central Administration v4" /text:ProcessModel.Password

Access BCS Data via C#

The below code snippet allows for access BCS data via C#

SPFarm farm = SPFarm.Local;
SPServiceProxyCollection spc = farm.ServiceProxies;
BdcServiceApplicationProxy sap = (BdcServiceApplicationProxy)(
                (from sp in spc 
                 where sp.TypeName.Equals("Business Data Connectivity Service")
                 select sp).First().ApplicationProxies.First());
DatabaseBackedMetadataCatalog catalog = sap.GetDatabaseBackedMetadataCatalog();

 IEntity ect = catalog.GetEntity("WPI.SharePoint.ITPMO.Data.BCS.Planview.ProjectData_Model", "ProjectDataEntity");
ILobSystem lob = ect.GetLobSystem();
ILobSystemInstance lobi = lob.GetLobSystemInstances()["ProjectData_Model"];
IFilterCollection filter = ect.GetDefaultFinderFilters();
IEntityInstanceEnumerator ects = ect.FindFiltered(filter, lobi);
while (ects.MoveNext())

JQuery Add New Item to SPList

        Task Title: 
        <input id="Text1" type="text" />
        <input id="Button1" type="button" value="Create Task" />

<script src=""></script>
    $(document).ready(function () {
        $("#newTaskButton").click(function () {

    function CreateNewItem(title) {
        var batch =
    "<Batch OnError=\"Continue\"> \
        <Method ID=\"1\" Cmd=\"New\"> \
            <Field Name=\"Title\">" + title + "</Field> \
        </Method> \

        var soapEnv =
    "<?xml version=\"1.0\" encoding=\"utf-8\"?> \
    <soap:Envelope xmlns:xsi=\"\" \
        xmlns:xsd=\"\" \
        xmlns:soap=\"\"> \
        <soap:Body> \
        <UpdateListItems xmlns=\"\"> \
            <listName>Tasks</listName> \
            <updates> \
            " + batch + "</updates> \
        </UpdateListItems> \
        </soap:Body> \

        var wsUrl = window.location.protocol + "//" + window.location.hostname + L_Menu_BaseUrl + "/_vti_bin/lists.asmx";
            url: wsUrl,
            beforeSend: function (xhr) {
                xhr.setRequestHeader("SOAPAction", "");
            type: "POST",
            dataType: "xml",
            data: soapEnv,
            complete: processResult,
            contentType: "text/xml; charset=utf-8"

    function processResult(xData, status) {

Export HTML Table to Excel with JS

<html xmlns="">
<head runat="server">
    <script Language="javascript">
        function TableToExcel() {
            var strCopy = document.getElementById("detailsTable").innerHTML;
            window.clipboardData.setData("Text", strCopy);
            var objExcel = new ActiveXObject("Excel.Application");
            objExcel.visible = true;

            var objWorkbook = objExcel.Workbooks.Add;
            var objWorksheet = objWorkbook.Worksheets(1);

        function exportToExcel() {
            var oExcel = new ActiveXObject("Excel.Application");
            var oBook = oExcel.Workbooks.Add;
            var oSheet = oBook.Worksheets(1);
            for (var y = 0; y < detailsTable.rows.length; y++)
            // detailsTable is the table where the content to be exported is
                for (var x = 0; x < detailsTable.rows(y).cells.length; x++) {
                    oSheet.Cells(y + 1, x + 1) = detailsTable.rows(y).cells(x).innerText;
            oExcel.Visible = true;
            oExcel.UserControl = true;
    <table id="detailsTable" border="1">
    <input id="clickExcel" type="button" value="button" onclick="javascript:TableToExcel()"/>
    <a href="javascript:exportToExcel();">Export to Excel</a><br/>

SharePoint Search Server 2010 Error

I was experiencing the below error message. While searching the internet and poking around on my SharePoint farm for a possible solution to the error i was able to find the below solution.

Error: The mount operation for the gatherer application [GUID] -crawl-0 has failed because the schema version of the search gatherer database is less than the minimum backwards compatibility schema version supported for this gatherer application. The database might not have been upgraded.

Solution: Go to the Central Admin and determine the status of the SharePoint DB's. A healthy state shows "No Action Required" for all DB's but in my case the majority of my DB's needed to be updated.
Http://[central admin]/_admin/DatabaseStatus.aspx

Finally run this command: psconfig.exe -cmd upgrade -inplace b2b -wait

Upon completion of running this command everything read "No Action required" and I was able to run the SharePoint crawl once again.

How to assign an exiting SharePoint group to a site using the SharePoint object model?

The below code demonstrates how you can assign a SharePoint Group to a SharePoint site  using the SharePoint object model.

SPSite spsite = new SPSite("Site_Name");
     using (SPWeb web = spsite.OpenWeb())
          web.AllowUnsafeUpdates = true;
          SPGroup sgrp = web.SiteGroups["Group_Name"];
          SPRoleDefinition roleDefinition = web.RoleDefinitions.GetByType(SPRoleType.Reader);
          SPRoleAssignment roleAssignment = new SPRoleAssignment((SPPrincipal)sgrp);
catch (Exception ex)



CAML Query Utility by U2U

This is a great utility which i have used countless times to generate CAML Queries.


Anonymous Access

We had a issue with Anonymous Access  in our production environment. Each time a user would go to that list information there would be prompted to login. We followed the the step below to get around it...

List Permission Settings

1.     Stsadm -o deactivatefeature -url -filename ViewFormPagesLockdown\feature.xml

2.     Break the inheritance for the list

3.     Uncheck the anonymous access for the list and save

4.     Reapply the anonymous access for the list and save

5.     Stsadm -o activatefeature -url -filename ViewFormPagesLockdown\feature.xml

Useful link...

Configurting BizTalk WS Adapter with ISAPI redirects work-around.

We recently encounted a problem trying to configure the BizTalk WS Adapters in our production environment and we were at a stand still until we ran into the below posted link that helped us rolling out our project to the production environment...

We received the below error message when we tried to configure the Windows sharepoint services adapter on a Load balanced Windows Server 2003 Environment.

"Error encoutered while querying virtual server state for URL: http//myserver/. Make sure the site is extended by Windows SharePoint Services. (CWssAdaCfg)"

THe below link provided a solution for us...

Thanks John Powell for the great post.

InfoPath: Debugging and Setting up a App.config

The below article explains how to setup a your InfoPath environment for local debugging...