Saturday, May 30, 2009

Save As Word Document Script

The following JS code will save the inner text of an element like ‹Div id="Save"›, the server must have Microsoft word installed on it and it works only on IE.

function SaveAsWord()
{
var sp = document.getElementById("Save");
var docApp = new ActiveXObject("Word.Application");
var doc = new ActiveXObject("Word.Document");
doc.Application.Visible=false;
doc.Content=sp.innerText;
// Show Save Dialog
doc.Save()
doc.Application.Quit();
}

Add To Favorites Script

function AddToFavorites()
{
var url = document.location.href;

if (window.sidebar)
{
// Mozilla Firefox
window.sidebar.addPanel(document.title, url ,"");
}
else if( window.external )
{
// IE
window.external.AddFavorite(url , document.title);
}
}

Saturday, March 21, 2009

VSeWSS 1.3 (Mar 2009 CTP)

Visual Studio 2008 extensions for Windows SharePoint Services 3.0, v1.3 - Mar 2009 CTP

The tools provide item templates for List Definition, List Definition from Content Type, Content Type, Field Control, Web Part, Module, Root File, Template, Event Receiver, and List Instance. It provides project templates for Team Site Definition, Blank Site Definition, List Definition, Web Part and Empty. It works with Visual Basic .NET and C# languages and a comprehensive user guide is included. It does not include the SharePoint Workflow templates as they are built in with Visual Studio 2008.

Sunday, March 08, 2009

Cross SharePoint Permission When Anonymouse Allowed

When Working With Anonymouse You Some Proplems in Permission The RunWithElevatedPrivileges Method Allow You to Executes a specified Code or method with Full Control rights even if the user does not otherwise have Full Control

SPSecurity.RunWithElevatedPrivileges(delegate()
{

//You Must Create SPSite Object and SPWeb Object Here

// Add Your Code Here Like Add Item to SharePoint List

});

Tuesday, February 24, 2009

SharePoint PreSaveAction


You can use below JavaScript function to execute any JavaScript Code in New or Edit Forms for SharePoint List before saving (When Pressing OK button this function will be fired first)

You can use this function for validation before PostBack

PreSaveAction()
{
    //Add Your JavaScript Code Here Then Return True Or False

    return false; // Cancel the item save process

    return true; // OK to proceed with the save item
}