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

Monday, November 7, 2011

SharePoint 2010 : Enhancements for Developers in SharePoint Foundation




Service application architecture

Redesigned infrastructure to facilitate sharing of resources across Web applications and farms.

Windows PowerShell support New support and capabilities for writing administrative scripts.
Feature versioning and upgrade New support for versioning and upgrading features.

SharePoint Developer Tools for Visual Studio 2010

A first-class development experience for SharePoint developers (finally).

Sandboxed solutions

New support for deploying solution packages at site collection scope in a sandboxed environment.

New features for throttling lists and controlling
query execution

Enhanced support for stabilizing the farm by prohibiting large,inefficient queries.

New events for sites, lists, and workflows

Additional events for developers to hook up event handlers.
LINQ to SharePoint provider

New support for writing LINQ query statements to access SharePoint list data.

REST-based access to SharePoint list items

New support for accessing SharePoint list data from across the network using REST-based Web service calls.

Client-side object model

Ability to leverage the SharePoint object model from across the network when programming with .NET, Silverlight, and JavaScript

Enhanced support for integrating Silverlight applications

Rich support for deploying and versioning Silverlight applications within a SharePoint environment

Claims-based security

New authentication support for leveraging external identity management systems and extending access control in SharePoint sites using custom claims

Business Connectivity Services (BCS) and external lists

New support for creating read-write connections to back-end databases and line-of-business systems and exposing their data as lists within SharePoint sites

NET Assembly Connectors for BCS

Support for creating a custom component to integrate any data source with the BCS.

Wednesday, November 2, 2011

SharePoint 2010 : Programmatically Add a Term to The SharePoint 2010 Term Store.

The new metadata features in 2010 are of great value to us. With each of our assets having a unique accounting identifier and our document contributors having room for improvement with naming documents favorably for search it could be a life savor!

Add following reference to the solution

using System.Globalization;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Taxonomy;
To add term in the term store, add following code

SPSite site = new SPSite("http://newdemo2010");
TaxonomySession taxSession = new TaxonomySession(site);
TermStore termStore = taxSession.TermStores["Managed Metadata Service"];
Group storeGroup = termStore.Groups["BPTemplate"];
TermSet termSet = storeGroup.TermSets["Timecard"];

termSet.CreateTerm(pTerm, 1033); //It will term to the root term

Term propertyIdsTerm = termSet.Terms["TimeLog"];
propertyIdsTerm.CreateTerm(pTerm, CultureInfo.CurrentCulture.LCID); //This
will add term to a term

Tuesday, October 4, 2011

SharePoint 2010 : Add video on Blog Post template

Open the blog site on which we want to show the YouTube video in SPD. Add below script at last of the master page before body tag.

<script type="text/javascript">
for (var i = 0; i < document.getElementsByTagName('*').length; ++i)
{if (document.getElementsByTagName('*')[i].id.indexOf('youtube') == 0)
{//get the parameters

var tagtoadd= document.getElementsByTagName('*')[i].innerHTML.split(',');
//create the string
var finalstring = '<object width="';
finalstring += tagtoadd[0];
finalstring += '" height="';
finalstring += tagtoadd[1];
finalstring += '"><param name="movie" value="';
finalstring += tagtoadd[2];
finalstring += '" /><param name="allowFullScreen" value="';
finalstring += tagtoadd[3];
finalstring += '" /><embed src="';
finalstring += tagtoadd[2];
finalstring += '" type="application/x-shockwave-flash" allowfullscreen="';
finalstring += tagtoadd[3];
finalstring += '" width="';
finalstring += tagtoadd[0];
finalstring += '" height="';
finalstring += tagtoadd[1];
finalstring += '" /></object>"';
//replace it
document.getElementsByTagName('*')[i].innerHTML = finalstring ;

Edit the post and add following tag in the html of the post body. The tag should be in below format.(<div align="center" id="youtubeSNBS1">425,355,http://www.youtube.com/v/7SGp9pA9cAY;&amp;hl=en;&amp;fs=1,true</div>



Publish the post and see the effect.







It works for all the browsers.

Thursday, July 21, 2011

SharePoint 2010 : Import List workflow in your custom solution

When you have to import the workflow in your solution, like for Sandbox solution. So, how you will be importing that list workflow in the VS 2010 sandbox solution. Many of us find like import reusable workflow in the VS 2010 solution. But what about the list workflows. And suppose if their is more then one workflow. I have also search lot on this topic and does not get not much help.

Solution Smile!!!!!!!!!!!!!!

To import List workflow on the VS solution. Create a WSP of the Site and import using the VS template  for SharePoint. Now Copy the ListInstances(On which list workflow are created),Modules of the workflow and WorkflowAssociations folders in our custom solution. Now build the solution. It will give some errors of workflow. So over come the errors add reference of following references

  • microsoft.sharepoint.WorkflowActions
  • System.Workflow.Activities
  • System.Workflow.Runtime

It will resolve the some of the errors. Now it will be giving the XOML errors. So to overcome these errors,you have add the same line of the tag from “importsolution.csproj” file to “customsolution.csproj”. Make it similar as import solution.

The changes should be done for workflow.xoml, workflow.xoml.wfconfig.xml and workflow.xoml.rules for all the workflow which are associated with all the list in the WSP. Now all the error will resolved. Deploy the solution and test. The workflow will work fine.

It will help in creation and deployment for the sandbox and SPD workflow. Comment if any help needed.

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,
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>

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;

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