Sunday, April 10, 2011

Tips and Tricks on using URL in SharePoint2010:

  • Customize DispForm.aspx/EditForm.aspx
o   Replace everything in the URL after “?ID=#“ with “&PageView=Shared&ToolPaneView=2”
  • Jump to web part page maintenance
o   ?contents=1
  • Remove all items in recycle bin
o   javascript:emptyItems();
  • Webpart Gallery
    • _Catalog/WP
  • Web Part Page Maintenance
    • ?contents=1(Add at the end of URL)
  • View All Site Content
    • /_layouts/viewlsts.aspx
  • Site Template Gallery
    • /_catalogs/wt
  • Site Settings
    • /_layouts/settings.aspx
  • Site Content Types
    • /_layouts/mngctype.aspx
  • Site Column Gallery
    • /_layouts/mngfield.aspx
  • Recycle Bin
    • /_layouts/AdminRecycleBin.aspx
  • Master Page Gallery
    • /_catalogs/masterpage(Also includes page layouts)
  • Manage User Permissions
    • /_layouts/user.aspx
  • Manage People
    • /_layouts/people.aspx
  • Manage Site Collection Administrators
    • /_layouts/mngsiteadmin.aspx
  • List Template Gallery
    • /_catalogs/lt
  • Create New Site Content
    • /_layouts/create.aspx
  • Add Web Parts Pane
?ToolPaneView=2(Note: Add to the end of the page URL; WILL ONLY WORK IF THE PAGE IS ALREADY CHECKED OUT)

Tuesday, April 5, 2011

Setting Unique Constraints Programmatically:

This post was moved with bit more clear explanation. To visit the post here:
http://mysharepointquicksolutions.blogspot.in/2012/02/setting-unique-constraints-programmatic.html












Unique Columns

You can create unique column (meaning the column will hold the unique data) inside a list in SharePoint 2010. The unique column MUST be indexed. So while creating the unique column, SharePoint 2010 will ask you to index the Unique Column. E.g. Student “Registration No” can be a unique column in the “Student” list. You can also make any existing column as unique column provided it has unique data for all the list items.
JOIN and Querying Data from Two Lists:-
Developers can query the SharePoint 2010 List using CAML and LINQ to SharePoint and select fields from two different lists as shown in the code below. Here in the below code ( LINQ To SharePoint), I have retrieved all the “Students” for the Department “Computer Science”.
Note: - In order to use LINQ to SharePoint you have to generate the “SharePoint Context” from the SPMetal tool (now comes as a part of SharePoint 2010), which is located at the following directory. (“C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN”). Here is syntax to generate your Context.cs file.
SPMetal /web:http://mossserver:8000 /namespace:SPTeamSite /code:SPTeamSite.cs
After this create a new project in VS2010, add the reference to Microsoft.SharePoint.Linq.dll & Microsoft.SharePoint.dll located at the following directory. (“C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI”). Also add the SPTeamSite.cs file generated from the SPMetal tool. See the diagram below.
Now here is the code to retrieve all the “Students” of a particular “Department”.

Note: We can set unique constraints to the list or lirary programtically. For this, plse refer the below url:
Setting Unique Constraints Programmatically:

Friday, April 1, 2011

Why Sandbox solution will not support Visual Webpart

The standard Visual Web Part is not supported in the sandbox environment. The reason for this is because Visual Web Parts effectively host an ASCX user control within the Web Part control. The ASCX file is deployed to the _controltemplates virtual directory in the physical file system on each Web front-end server. The sandbox environment does not allow you to deploy physical files to the SharePoint root, so you cannot use a sandboxed solution to deploy a Visual Web Part based on the Visual Studio 2010 Visual Web Part project template.

A Visual Studio Power Tool is available that addresses this issue. A Power Tool is a plug in for Visual Studio. The tool will generate and compile code representing the user control (.ascx) as part of the assembly. This avoids the file deployment issue. You can download a Power Tool for Visual Studio 2010 that supports Visual Web Parts in the sandbox from
Visual Studio 2010 SharePoint Power Tools on MSDN.