If somebody like the post and its helpful in your work then, add comments.

Thursday, July 21, 2011

SharePoint 2010 : Creating a Web/Site template

What Are Web Templates in general?
We can a web site template is a pre-designed web page or simply a web page without or with basic contents. Right?

What is web template in the SharePoint term?
Web templates on the other hand, are stored in the database, and are created using an existing site, with or without its specific content, as a model. This provides a means for reusing sites that you have customized.

In SharePoint 2007/2010 the meaning is same for both the version. But creating a web template is now different in the both version, means approach is different.
Like in MOSS we can create the web template using the existing site, SPD 2007 for UI and WSP for deployment. But in the SharePoint now you can create your Custom Web template using the SharePoint existing site. Well, for the custom template first you have to design and implement all the requirement on the existing site, and save the template in the Site templates. But here is the slightly change, we can create two types of the site template solution,
Farm
Sandbox
In VS 2010 their is a new template for the creating the solution from existing WSP is Import SharePoint Solution Package.

Import SharePoint Solution Package

Now you can import your WSP in this solution and you can write your custom code or now you can modify UI etc. It will give great help when you are creating a sandbox solution and does not want to write a code. then just deploy all the solution on existing site and use that site WSP to import in this solution. Extract your required solution from it and implement in the your solution.

Wednesday, July 20, 2011

SharePoint 2010: Challenges in the Sandbox

Well, Challenges :),

In sandbox if we have to create like simple custom branding (Master Page, CSS etc.) then first it seems like very simple task for the developers. But, is it simple....well in some respect yes like we can create a solution in the Visual Studio 2010,check to deploy it as sandbox but when we have deploy the solution and activate on the site collection it is very tough job to make. Sometime the service behavior weird, or sometimes it is gone off etc. And on Office 365 it is also new monster for developer to deploy the solution. And it has lesser privileges, options. Like an event receiver on the sandbox, we can create an event receiver in VS 2010 and now we have to attach it with specific list, but the way is different. It can be performed using the configuration XML. But is it does the required work, when I have tried that it is unable to attach with list, even in the debugger :).

So, in Sandbox solution, many sectors want to migrate their farm solution (Fully trusted solution) in the sandbox solution, to reduce the cost of IT, maintenance etc. But I think on that part they have to compromise on the many of the expectation.

Well sandbox decision is quiet tricky one, just creating a static or less functional site it will good for small scale companies but for fully functional rich facility we have to use other option.

Tuesday, April 19, 2011

InfoPath 2010 VSTA Error : The Web application at [URL] could not be found.

In VSTA when we want interact with SharePoint objects, then we got this below error.

The Web application at could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.

The reason is that when we install Office 2010 32 bit and now targeting the 64 bit environment. So, just uninstall the Office 32 bit and install 64 bit version. It will resolve the issue.

Tuesday, February 22, 2011

SharePoint 2010 : Run Video on the SharePoint page ,web part or web server control

Being able to insert video into a SharePoint 2007 page is not as straightforward as you might think. Generally it’s accomplished by copying/pasting embed code in the content editor web part, or by finding a 3rd party solution that fits your needs.

Now you can plug a video right into a page OOTB. Silverlight controls are used to render the video in the browser. Another cool bonus here is that you can preview the video before inserting it.

When browsing your media with the asset picker, you can play the entire video to make sure you’re inserting the right one.

But when we need to play the video on any custom control or web part then the embed tag and other methods to run the video does not supported by the SharePoint 2010. Then how can show video on the SharePoint 2010? The simpler way is that when you add OOTB web part on the SharePoint, you see the source of the page and you can get the tag which is used by the Silverlight video web part. The tag is :

<object type="application/x-silverlight-2" data="data:application/x-silverlight-2," width="100%"  height="100%">
<param name="source" value="/_layouts/clientbin/mediaplayer.xap"/>
<param name="enableHtmlAccess" value="true"/>
<param name="windowless" value="true" />
<param name="background" value="#80808080" />
<param name="initParams" value="mediaSource=/SiteAssets/Search in SharePoint Server 2010.wmv,previewImageSource=/Style Library/Media Player/VideoPreview.png" />

<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"><img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/></a><a href='/SiteAssets/Search%20in%20SharePoint%20Server%202010.wmv' class='media-link'></a>
</object>



There is two place you have to give the location of the video initParams and href. Second is the preview image of the video location in previewImageSource.



You can upload the video and image in the library and can show video on the web part or web server control or in the simple page layout. So, now its very easy to run video in our custom web part or control.



Enjoy SharePoint 2010 Smile

Tuesday, January 18, 2011

SharePoint : Get current Navigation using the Object Model

Use below method to get the Quick Launch information from the current web.

public static void QuickLaunch()
{
using (SPSite site = new SPSite(strSiteCollectionURl))
{
using (SPWeb web = site.OpenWeb()) //Can user SPContext.Current.Web
{
SPNavigationNodeCollection quickLaunchNodes = web.Navigation.QuickLaunch;

//Parent
foreach (SPNavigationNode node in quickLaunchNodes)
{
string strParentTitle = node.Title;
string strParentURL = node.Url.ToString();
Console.WriteLine("Parent : "+strParentTitle + " : " + strParentURL);
//Children
SPNavigationNodeCollection children = node.Children;
foreach (SPNavigationNode child in children)
{
string strTitle =child.Title;
string strURL = child.Url.ToString();
Console.WriteLine("Child : " + strTitle + " : " + strURL);
}
}

Console.ReadKey();
}
}
}

Sunday, December 19, 2010

Exchange Calendars Overlay in SharePoint 2010 Publishing Site

To activate the calendar overlay in the publishing site in sharepoint 2010. Just follow these below steps
  • Go to Site Settings
  • Go to Site Features
  • Activate the following feature "Team Collaboration Lists"
    TeamCollaborationList
  • Create Calendar type list
Now you can see the Calendar Overlay feature in the calendar list.
SchoolCalendar

Configuration of the Calendar Overlay Feature Follow below steps

  1. Click on calendar overlay in the Calendar view of the ribbon
    SNAG-0000
  2. Click on New Calendar Link
    SNAG-0001
  3. Enter the details and click OK
    SNAG-0003

After the above configuration, possibly you will get error like "Could not establish trust relationship for the SSL/TLS secure channel with authority"
Follow bellow steps
  • Go to "Central Administration" and click on "Security"
  • Under "General Security" click on "Manage trust"
  • Create a name (e.g. Name: Webmail)
  • Root certificate for the trust relationship:
  • Click OK
  • You need to specify the correct root cert for it to work

This will complete your configuration in the SharePoint Calendar Overlay.
Keep in mind that user should be in the domain of the Exchange and SP2010. Otherwise you will get this type of error "You should set Exchange e-mail address into your user profile to retrieve calendar data from Exchange server".

Enjoy SharePoint 2010 :)

Thursday, December 9, 2010

Content Query Web Part error “Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.”

Well this error occurs when you have not configured AAM (Alternet Access Mapping)for the particular web application. Suppose if the internal URL is http://server:81 and you are accessing the URL out of the server by mapping the DNS, then you will face this issue in the web part. SO, to resolve this issue just configure the public URL for the http://server:81 to like http://www.sample.com/.net etc.

Wednesday, December 1, 2010

STSADM on adding wsp Error “Object reference not set to an instance of an object. sample.wsp: The Solution installation failed. ”

Hi, Well today when I was deploying the SharePoint site I got the above error. Well on first look it seems that this is SPSite or SPWeb or we can say that this object model issue. But I got info from googling that this issue comes due to permission on the content db from which the user is deploying the WSP by using the STSADM command. Well I looking for more options for that but it seems that the issue is due to user permission on content db.

And guess it works. Well when you dont have permission on the Admin_content db then this issue will occur.

The below command will also help you check the permission

stsadm -o enumsites -url http://yoururl

Wednesday, October 6, 2010

SharePoint 2010: What is Sandbox Solution?

Well,

Many of the SharePoint are working on the SharePoint for a long time. Many of then also started working in the SharePoint 2010. Their are many things that SharePoint 2010 made easier then from SharePoint 2007/Moss. Many improvements are given to the SharePoint to that it can build a better solution.

If you have been reading about exciting new features of SharePoint 2010 you probably heard about something called SandBox Solutions.  What is the Sandbox solution?

SharePoint is a rich development platform with a large community actively developing solutions. The challenge, however, has always been the balance between creating solutions and deploying them in a way that you can trust will not damage or impair the SharePoint farm. Sandboxed solutions, new in SharePoint 2010, address this by allowing site collection administrators to deploy solutions that are safe to run. Sandboxed solutions are restricted to running under a subset of the SharePoint API and the framework can monitor these solutions and shut down any that risk the stability of the farm.

SandBox Solutions support the following SharePoint item types:

  • List definitions
  • List instances
  • Content Types/Fields
  • Navigation
  • Web Parts derived from WebPart
  • Event receivers
  • Custom Workflow Actions
  • Workflows

Development

For developing a sandbox solution you have to just create a new blank SharePoint Solution in Visual Studio 2010. Go to properties of the solution and change the solution type to true.

SanJuan013 

Deploying Sandboxed Solutions

The structure of a sandboxed solution is very similar to a farm solution, which generally runs with full-trust permissions. The main differences lie in how a sandboxed solution is deployed and in the process that hosts the solution (which determines whether a solution is a sandboxed solution or a farm solution). This means that the same sandboxed solution can run with full trust when it’s deployed at the farm level and with partial trust when it’s deployed at the site collection level.

SanJuan014

Monday, September 6, 2010

SharePoint 2010 : Paging in the SharePoint list

Hi,

Paging in the SharePoint 2010 list is done using the

SPListItemCollectionPosition 

The SPListItemCollectionPosition class supports paging through data sets, storing the state that is needed to get the next page of data for a specific view of a list.

ListItemCollectionPosition

Gets or sets an object that is used to obtain the next set of rows in a paged view of a list. The below code I have refined from the following link. It will return the given page like page 3, items say 4.



public static SPListItemCollection ExecuteCAMLToRetrieveListItemsInPages( string listName, string viewName, 
string caml, string[] columnNames, int pageIndex, int pageItemCount)
{
SPListItemCollection postDetailsItems = null;
using (SPSite Site = new SPSite(SPContext.Current.Site.Url))
{
using (SPWeb sharePointWeb = Site.AllWebs[XYZ])
{
// Check if the SharePoint web object is not null or not.
if (sharePointWeb == null)
{
}
// Get the Post List
SPList postList = sharePointWeb.Lists[listName];
// Get the SPLIst View
SPView listView = postList.Views[viewName];
SPQuery query = new SPQuery(listView);
query.Query = caml;
// Retrieve the items for the last page. E.g.: If request is for 5th page and item count/page=10 then row limit will retrieve
//40 items and 40th item will be used to get the column details which will be used for pagination.
query.RowLimit = (uint)(pageItemCount * (pageIndex - 1));
postDetailsItems = postList.GetItems(query);
// Get the previous page last item position. Use this item to retrieve the column details which will be used for pagination.
int previousPageLastItemPosition = postDetailsItems.Count - 1;
StringBuilder columnBuilder = new StringBuilder();
// Form the paging filter query string
if (columnNames != null)
{
foreach (string column in columnNames)
{
// Make sure that if the field value is mandatory and if you are passing it as NULL then SPList.GetItems will throw exception.
string columnValue =
(postDetailsItems[previousPageLastItemPosition][column] == null) ? string.Empty : postDetailsItems[previousPageLastItemPosition][column].ToString();
// Check if the value is null or empty
columnBuilder.Append("&p_" + column + "=" + columnValue);
}
}
query = new SPQuery(listView);
query.Query = caml;
// Create Paging Information which will be used for retrieving paging based items
SPListItemCollectionPosition objSPListColPos = new SPListItemCollectionPosition("Paged=TRUE" + columnBuilder.ToString());
query.RowLimit = uint.Parse(pageItemCount.ToString());
query.ListItemCollectionPosition = objSPListColPos;
// Execute the CAML query.
postDetailsItems = postList.GetItems(query);
}
} return postDetailsItems;
}