Showing posts with label Sharepoint 2010. Show all posts
Showing posts with label Sharepoint 2010. Show all posts

Saturday, January 14, 2012

SharePoint TextArea Auto resize

Scenario:
Client wanted to have all the multi-line text-boxes to adjust width automatically like Facebook.

And I love SharePoint for its great flexibility where you can use all great jQuery plugin's of the world within SharePoint ( with small tweaks )

Solution:
I have used the Elastic project , jQuery plugin.
You can download files here Elastic

Code:

<script type="text/javascript" src="/_layouts/ClientFolder/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="/_layouts/ClientFolder/jquery.elastic.source.js"></script>

<script type="text/javascript">
_spBodyOnLoadFunctionNames.push("AdjustTextArea");

function AdjustTextArea() {

jQuery.noConflict();

jQuery('textarea').elastic();
jQuery('textarea').trigger('update');

}
</script>

<asp:TextBox ID="txtComments" runat="server" TextMode="MultiLine" Rows="6" Width="100%" />
Found a Bug:
As I was trying to use it with SP2010, I applied a CssClass="ms-long" and got a weird behavior of text box restricting to show only 29-30 lines. So removed it.

Wednesday, January 4, 2012

SharePoint Issues with HTML files

Scenario:
I have migrated few HTML files from MOSS Document Libraries to SP2010 Document Libraries. On click of these HTML files , I am getting a download file prompt.

In MOSS , there is no such issue. Click HTML file renders the file.

Reason:
SP2010 has restrictions on displaying or opening some files. This was not the case in MOSS 2007.

Solutions:
Revisit HTML files and try converting them to ASPX pages. This is highly recommended.

OR

From Central administration > Web Application General Settings > Check the "Browser File Handling" to "Permissive" for that web application. This does open some holes. Recommended only in intranet type scenario's.

Article:
Understand permissive option

Sunday, August 28, 2011

Print button for Custom list with Infopath form

Scenario:
We wanted to extend the Ribbon to have a Print button for Custom list with Infopath form.

While I found so many articles to extend Ribbon UI, most of them are for a regular list / library. In SP2010, now we do have an option to use a Infopath for a custom list which uses a brand new Ribbon Tab/Grouping and I found nothing much on Web.

Solution:
Use the following Element manifest.

Code:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="InfopathformPrintButton"
Location="CommandUI.Ribbon" Rights="ViewListItems">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition
Location="Ribbon.Tabs.InfoPathListDisplayTab.Manage.Controls._children">
<Button Id="Ribbon.Tabs.InfoPathListDisplayTab.Manage.Controls.Print"
Command="CallPrint"
Sequence="1"
Description="Print the infopath form"
Image16by16="/_layouts/images/placeholder32x32.png"
Image32by32="/_layouts/images/placeholder32x32.png"
LabelText="Print"
TemplateAlias="o1"/>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="CallPrint"
CommandAction="javascript:function processPrint(){window.print()};processPrint();" />
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
</Elements>

Monday, March 14, 2011

SP2010 Few code changes for 2007 code

Scenario:
While a lot of my clients are asking for migration to SP2010 from MOSS2007. One important task is to upgrade the code / solutions. So I though of start documenting few code/design change to utilize new APIs.

Design Changes:
1. ContentIterator class for processing large lists ( 5000+ items )
2. Remote Blob storage for very large files ( 50MB+ )
3. Sandbox solutions ( Webparts / Infopath wide code-behind etc. )
4. Client Object Model
5. Powershell based deployments

Code related Changes:


// 1. Easy to validate column exist or not
if(list.Fields.ContainsFieldWithStaticName(columnName))
{
// do something
}

// 2. Easy to get field by internal name
SPField field = list.Fields.GetFieldByInternalName(columnName)

// 3. Code return null in case list is not present
SPList list = web.Lists.TryGetList(listTitle)

// 4. Working with folders is better now
if(folders.TryGetFolder(folderUrl, out folder))
{
// do something
}

// 5. Check if the list has folders other than the root folder
if (!SPFolderHierarchy.ListHasFolders(list))
return;

// 6. Cache support - brand new in SP2010
SPCache.Cache.Put(DataCache, new SPCachedObject("TestKey", new TestCustomClass(), null, new TimeSpan(1, 0, 0)));

SPCache.Cache.Get(DataCache, "TestKey");
SPCache.Cache.Delete(DataCache, "TestKey");

// 7. Client Object Model based utilities
var encodedUrl = SP.Utilities.HttpUtility.ecmaScriptStringLiteralEncode(viewServ);

SP.Utilities.HttpUtility.appendSourceAndNavigateTo(this.newUrl);

// 8. Client Object Model based utlities - 2
this.imageUrl = SP.Utilities.Utility.getImageUrl('sandeepPhoto.jpg');
this.pageUrl = SP.Utilities.Utility.getLayoutsPageUrl('myHome.aspx')




Article:
I will update this post on regular basis with new findings.

Saturday, November 13, 2010

SP2010 Model window closing automatically

Scenario:
Now since SP2010 have lot of support in-build for client side programming, I thought to leverage the same for one of the Pop Up requirement. User will click a button and there will a model popup to select values , selected value will be returned back to main window.

Issue : Model window was poping up but getting closed right away.

Reason:
I was using a ASP.Net server side Button , and so I realized that it is calling the client script on button click which is poping up the model window properly but then as soon as postback happens it was getting closed.

Solution:
There are 2 solutions to it in my opinion
1. Switch to HTML input control
2. return false from the function which you are using to open model window, which will prevent the server side event.

Code:


function myCallback(dialogResult, returnValue) {alert('Hello');}

function openSPModel(
var options = {url: '/_layouts/mypage.aspx', width: 500, dialogReturnValueCallback:myCallback};

SP.UI.ModalDialog.showModalDialog(options);
return false;
}

Article:

Tuesday, October 26, 2010

BCS Model not updated

Scenario:
I am working with a BCS Model and it is not picking up the change.

Solution:
While cache-ing is great for enterprise applications but sometime I hate it , specially during development , where we want to see the change with zero lag. Anyway I don't think so that's gonna happen. So we developers have our own tricks / steps to deal with it

Steps to Refresh BCS Model:
Assuming you are deploying using WSP package.

01. Retracted exisiting solution i.e. "myModel.wsp"
02. Navigate to BCS Service application and Deleted Model from everywhere
03. IISReset
04. Restarted "SharePoint Server Search 14" service
05. Deployed the new solution i.e. "myModel.wsp"
06. Navigate to BCS Service Application and add object permissions for your model
07. ( Optional ) Create/Upgrade the profile pages
08. Navigate to "Search Service Application" and re-crawl fully the Content Source using your Model
09. Once finished , Check the error log.
10. If all went smooth then checked the crawled properties, they should be there

Tuesday, August 17, 2010

ListView from other site collection

Scenario:
ListView Webpart and new XsltListViewWebpart are great new controls to display list/library information from with in the sub-site.

But we had a little bit different requirement. As we wanted to display list views from other site collection / sub-site.

Solution:
For control List is a list , as long as we can code it and bind it to right control.

Few options we tried/thought of

1. Create a new Datatable and load it with view items and then using SPGridView bind it. ( Good 30-40 lines of code )

2. Create a new SPDataSource pointing to right list id and bind it to SPGridView.
( 10-15 lines of code )

3. Create a ListViewWebpart and point the ListId and ViewGuidId property to right values. ( 10-15 lines of code )

4. Create a XsltListViewWebpart and point the ListId and ViewGuidId property to right values. ( 10-15 lines of code )

5. How about get right SPView and render it with 2 line. I am still showing from same site collection but you can create a new object from other site collection and do the same. See below

Code:

 protected override void Render(HtmlTextWriter writer)
{
base.Render(writer);
writer.Write(SPContext.Current.Web.Lists["Tasks"].DefaultView.RenderAsHtml());
}
CRUX of the post is RenderAsHtml is AWESOME :)

Thursday, August 5, 2010

Left Nav Toggle with persistence

Scenario:
While now web is flooded with amazing scripts that can increase user experience, there is always a need to develop something new very specific to your client.

So my client wanted to Toggle left navigation with persistence. Simple script did the magic.

Solution Details:
You can add this script to master page to provide functionality throughout. Two main pieces which drives this are :

1. JavaScript ( to be placed in head tag )
2. HTML control/element to trigger the call to JavaScript function
3. JavaScript ( to be placed at the end of the page, so that it can execute on page load )

JavaScript( this will go in head tag ):

<script type="text/javascript" >

function getCookie(Name) {
var re = new RegExp(Name + "=[^;]+", "i"); //construct RE to search for target name/value pair
if (document.cookie.match(re)) //if cookie found
return document.cookie.match(re)[0].split("=")[1] //return its value
return ""
}

setCookie = function setCookie(name, value) {
document.cookie = name + "=" + value + ";path=/" //cookie value is domain wide (path=/)
}


function togglefn() {

var e = document.getElementById('s4-leftpanel');
var e1 = document.getElementById('MSO_ContentTable');

if (e.style.display != "none") {
setCookie('showLeftNav', 'no');
e.style.display = "none";
e1.style.marginLeft = "10px";
}
else {
setCookie('showLeftNav', 'yes');
e.style.display = "block";
e1.style.marginLeft = "155px";
}
}
</script>
HTML element ( some where in body tag):
<a href="javascript:togglefn();">hide/show</a>

JavaScript( this will go towards page end ):
<script type="text/javascript" >
var persistedLeftNav = getCookie('showLeftNav');

if (persistedLeftNav == 'undefined') {
setCookie('showLeftNav', 'yes');
}
else {
if (persistedLeftNav == 'no') {
togglefn();
}
}
</script>

IsDlg Query parameter

Scenario:
With the new design of SharePoint 2010 we have more context aware UI navigation.
We have now popup for pages which shows only the main content of the page.

In case you need to write a new ASPX which you want to display as popup, which master to inherit ??

Solution:
Answer is simple - same default.master , actually SP2010 Design allows you to hide left navigation and top bar just by adding Query parameter

IsDlg=1

i.e. http://intranet.contoso.com/_layouts/create.aspx?IsDlg=1

Assuming you have a custom Div
<div id='customDiv' class='s4-notdlg'> Hello </div>

You can use JQuery to do the adjustments.


<script type="text/javascript">

function querySt(ji) {

hu = window.location.search.substring(1);
gy = hu.split("&");

for (i=0;i<gy.length;i++) {
ft = gy[i].split("=");

if (ft[0] == ji) {
return ft[1];
}
}
}

var IsDlg = query("IsDlg");

$(document).ready( function() {

if(IsDlg)
{
$("#CustomElement).attr('style','display:none');
}

});
</script>


Also one more thing. In case of custom development, if you have some html you want to hide when it is rendered as popup. Apply following css to the div element wrapping your html

class="s4-notdlg"

Try for yourself

Nice to have:
Infact if client have a page with too much content and client want to focus on data by hiding left nav/top bar , you can quickly add a javascript function to give him Toggle functionality for the chrome.

Article
Reading Query String

All People link missing in SharePoint 2010

Scenario:
In SharePoint 2007 we use to have multiple links to handle security and one of the navigation items was 'All People' , which is missing now in SP2010.

'All People' was really helpful in case you want to see what all people have access to site irrespective of which group/role they belong to.

Microsoft felt its not worth having it in SP2010. GREAT but I needed it.

Workaround/Solution:
1. Click on any group to see who all belong to this group.
2. Examine the Address Bar Url and one of the Query parameter is 'MembershipGroupId'
3. Update its value to 0 and you got All People output

Thursday, July 29, 2010

Customizing XsltListView webpart look and feel

Scenario:
SharePoint 2010 introduces a new webpart XsltListView webpart. It is suppose to me new and enhanced version of DataView webpart with the convience of ListView Webpart.

Unfortunatly it is not.. Customizing Xslt is a pain. After spending good amount of hours, I was able to make it work the way I wanted.

I FEEL the OOTB XSLT for this webpart IS A BIG DESIGN MISTAKE made by Microsoft SharePoint team. Not at all scalable.

Steps:
1. Create a new webpart page

2. Add webpart for the existing list/library you want to customize look and feel.

3. Exit Editing

4. Edit Webpart to add more columns to the view specially the one's you need in your final output.

5. Open the page in design mode now using SPD 2010

6. Click on webpart , you will see new Ribbon Tabs 'Design'

7. Click on 'Customize Xslt' > 'Customize Entire View'. Once you do that and switch to code view, you will see a new node with stylesheet information added to the webpart

8. Search for 'mode="Item"' keyword , this is the main template which will drive rendering of each row

9. With in this template , search for <xsl:for-each select="$Fields" > tag. This is the loop which will make call to other templates to render each field.

10. Delete or Hide the loop statement fully and add your own HTML before this to render the view. I will recommend using SPD to fields/value.

11. Remember to check the changes/output in browser when you make the change.

12. As we have already deleted the Xslt For-each loop. We can delete all the field templates generated automatically. But sometime this is tricky, so no harm in keeping them also.

13. Once you are satisfied with the output, copy the stylesheet into a new file, mylistview.xslt and save it some plac, like a document library.

14. Now you can create a new page and add the List/Library webpart as we did in step 2.

15. Edit webpart and in Miscellaneous section XSL Link textbox , link the XSLT file and save settings.

Advantages:
1. Customization just like we had in DataView
2. Much smaller ( in size ) XSLT file
3. Ribbon Context Tabs will work with the webpart.

Error copying reusable workflow

Scenario:
SharePoint has reusable workflows newly introduced in SP2010. Using SPD you can also modify existing workflows to fit your requirements.

Today I asked my collegue to work on a task which required to reuse an OOTB workflow. But when she click on 'Copy & Modify' button from the ribbon. She keep getting following errors:

This workflow is readonly. Would you like to make a copy of this workflow to open or edit ?
error1

On saying Yes , you get 'Server could not complete your request.For more specific information, click the Details button.'
error2

Solution:
SharePoint will continue to be popular for its weird error message. As in this case.. no error message :)

One of the reason this can happen is if you are working on a sub-site of site collection.

Switch to RootWeb of the site collection and using SharePoint Designer try copying the Workflow, it will work.

Monday, July 19, 2010

Workflow Visualization Visio not showing

Scenario:
In SP2010 we have option to Visualize a workflow. But I created a new instance of OOTB approval workflow and it was missing the Visualization.. so whats going on ??

Check few things:

Ensure that you have Visualization option turned on for your workflow.Here's what you need to look for in SPD.
option

Check for the feature to enable visio web access
feature

Also make sure Visio Graphic Service is started.
visiossa

Article:

Wednesday, July 7, 2010

SP2010 : Webpart export option missing

Scenario:
I have used webpart export option a lot in 2007 , but while working on one of SP2010 project I found that this option is missing for few webpart.
missing

Solution:
Actually it is not missing. Microsoft has made it hidden by default.
So if you follow the steps below, you can get the option back.

Steps:
1. Edit the webpart

2. Under Advanced Settings look for Export option
ori

3. Change the option to Export All
ch

4. Save the webpart configuration and you have the option back in place now

back

Note:
This technique may not work for all the webparts. i.e. ListView webpart doesn't support Export

Thursday, June 24, 2010

SP2010 : Feature Ids

Scenario:
While writing site definition I wanted to activate some OOTB features and need their ids.

Solution:
Here the list of out-of-box feature Ids for SP2010 ( not all) which I found.Code:

<SiteFeatures>
<!--PublishingPrerequisites Feature-->
<Feature ID="{a392da98-270b-4e85-9769-04c0fde267aa}" Name="FeatureDefinition/a392da98-270b-4e85-9769-04c0fde267aa" />
<!--PublishingResources Feature-->
<Feature ID="{aebc918d-b20f-4a11-a1db-9ed84d79c87e}" Name="FeatureDefinition/aebc918d-b20f-4a11-a1db-9ed84d79c87e" />
<!--Navigation Feature-->
<Feature ID="{89e0306d-453b-4ec5-8d68-42067cdbf98e}" Name="FeatureDefinition/89e0306d-453b-4ec5-8d68-42067cdbf98e" />
<!--PublishingLayouts Feature-->
<Feature ID="{d3f51be2-38a8-4e44-ba84-940d35be1566}" Name="FeatureDefinition/d3f51be2-38a8-4e44-ba84-940d35be1566" />
<!--AssetLibrary Feature-->
<Feature ID="{4bcccd62-dcaf-46dc-a7d4-e38277ef33f4}" Name="FeatureDefinition/4bcccd62-dcaf-46dc-a7d4-e38277ef33f4" />
<!--EnhancedTheming Feature-->
<Feature ID="{068bc832-4951-11dc-8314-0800200c9a66}" Name="FeatureDefinition/068bc832-4951-11dc-8314-0800200c9a66" />
<!--EnterpriseWikiLayouts Feature-->
<Feature ID="{a942a218-fa43-4d11-9d85-c01e3e3a37cb}" Name="FeatureDefinition/a942a218-fa43-4d11-9d85-c01e3e3a37cb" />
<!--Ratings Feature-->
<Feature ID="{915c240e-a6cc-49b8-8b2c-0bff8b553ed3}" Name="FeatureDefinition/915c240e-a6cc-49b8-8b2c-0bff8b553ed3" />
<!--WAReports Feature-->
<Feature ID="{2acf27a5-f703-4277-9f5d-24d70110b18b}" Name="FeatureDefinition/2acf27a5-f703-4277-9f5d-24d70110b18b">
<Properties>
<Property Key="GloballyAvailable" Value="true" />
<Property Key="RegisterForms" Value="*.xsn" />
</Properties>
</Feature>
<!--LocalSiteDirectoryControl Feature-->
<Feature ID="{14aafd3a-fcb9-4bb7-9ad7-d8e36b663bbd}" Name="FeatureDefinition/14aafd3a-fcb9-4bb7-9ad7-d8e36b663bbd" />
<!--PortalLayouts Feature-->
<Feature ID="{5f3b0127-2f1d-4cfd-8dd2-85ad1fb00bfc}" Name="FeatureDefinition/5f3b0127-2f1d-4cfd-8dd2-85ad1fb00bfc" />
<!--WebPartAdderGroups Feature-->
<Feature ID="{2ed1c45e-a73b-4779-ae81-1524e4de467a}" Name="FeatureDefinition/2ed1c45e-a73b-4779-ae81-1524e4de467a" />
<!--DocumentRoutingResources Feature-->
<Feature ID="{0c8a9a47-22a9-4798-82f1-00e62a96006e}" Name="FeatureDefinition/0c8a9a47-22a9-4798-82f1-00e62a96006e" />
<!--RecordResources Feature-->
<Feature ID="{5bccb9a4-b903-4fd1-8620-b795fa33c9ba}" Name="FeatureDefinition/5bccb9a4-b903-4fd1-8620-b795fa33c9ba" />
<!--PublishingSite Feature-->
<Feature ID="{f6924d36-2fa8-4f0b-b16d-06b7250180fa}" Name="FeatureDefinition/f6924d36-2fa8-4f0b-b16d-06b7250180fa" />
<!--IPFSSiteFeatures Feature-->
<Feature ID="{c88c4ff1-dbf5-4649-ad9f-c6c426ebcbf5}" Name="FeatureDefinition/c88c4ff1-dbf5-4649-ad9f-c6c426ebcbf5" />
<!--BizAppsSiteTemplates Feature-->
<Feature ID="{4248e21f-a816-4c88-8cab-79d82201da7b}" Name="FeatureDefinition/4248e21f-a816-4c88-8cab-79d82201da7b" />
<!--BizAppsCTypes Feature-->
<Feature ID="{43f41342-1a37-4372-8ca0-b44d881e4434}" Name="FeatureDefinition/43f41342-1a37-4372-8ca0-b44d881e4434" />
<!--BizAppsFields Feature-->
<Feature ID="{5a979115-6b71-45a5-9881-cdc872051a69}" Name="FeatureDefinition/5a979115-6b71-45a5-9881-cdc872051a69" />
<!--ExcelServerWebPart Feature-->
<Feature ID="{4c42ab64-55af-4c7c-986a-ac216a6e0c0e}" Name="FeatureDefinition/4c42ab64-55af-4c7c-986a-ac216a6e0c0e" />
<!--VisioWebAccess Feature-->
<Feature ID="{9fec40ea-a949-407d-be09-6cba26470a0c}" Name="FeatureDefinition/9fec40ea-a949-407d-be09-6cba26470a0c" />
<!--MossChart Feature-->
<Feature ID="{875d1044-c0cf-4244-8865-d2a0039c2a49}" Name="FeatureDefinition/875d1044-c0cf-4244-8865-d2a0039c2a49" />
<!--SearchExtensions Feature-->
<Feature ID="{5eac763d-fbf5-4d6f-a76b-eded7dd7b0a5}" Name="FeatureDefinition/5eac763d-fbf5-4d6f-a76b-eded7dd7b0a5" />
<!--FastEndUserHelpCollection Feature-->
<Feature ID="{6e8f2b8d-d765-4e69-84ea-5702574c11d6}" Name="FeatureDefinition/6e8f2b8d-d765-4e69-84ea-5702574c11d6" />
<!--AccSrvSolutionGallery Feature-->
<Feature ID="{744b5fd3-3b09-4da6-9bd1-de18315b045d}" Name="FeatureDefinition/744b5fd3-3b09-4da6-9bd1-de18315b045d" />
<!--Fields Feature-->
<Feature ID="{ca7bd552-10b1-4563-85b9-5ed1d39c962a}" Name="FeatureDefinition/ca7bd552-10b1-4563-85b9-5ed1d39c962a" />
<!--CTypes Feature-->
<Feature ID="{695b6570-a48b-4a8e-8ea5-26ea7fc1d162}" Name="FeatureDefinition/695b6570-a48b-4a8e-8ea5-26ea7fc1d162" />
<!--OffWFCommon Feature-->
<Feature ID="{c9c9515d-e4e2-4001-9050-74f980f93160}" Name="FeatureDefinition/c9c9515d-e4e2-4001-9050-74f980f93160">
<Properties>
<Property Key="EnsureRootPublicLibrary" Value="true" />
<Property Key="RegisterForms" Value="Forms\*.xsn" />
<Property Key="GloballyAvailable" Value="true" />
</Properties>
</Feature>
<!--ExpirationWorkflow Feature-->
<Feature ID="{c85e5759-f323-4efb-b548-443d2216efb5}" Name="FeatureDefinition/c85e5759-f323-4efb-b548-443d2216efb5">
<Properties>
<Property Key="RegisterForms" Value="Forms\*.xsn" />
<Property Key="GloballyAvailable" Value="true" />
</Properties>
</Feature>
<!--ReportServer Feature-->
<Feature ID="{e8389ec7-70fd-4179-a1c4-6fcb4342d7a0}" Name="FeatureDefinition/e8389ec7-70fd-4179-a1c4-6fcb4342d7a0" />
<!--BaseSite Feature-->
<Feature ID="{b21b090c-c796-4b0f-ac0f-7ef1659c20ae}" Name="FeatureDefinition/b21b090c-c796-4b0f-ac0f-7ef1659c20ae" />
<!--ReviewWorkflowsSPD Feature-->
<Feature ID="{b5934f65-a844-4e67-82e5-92f66aafe912}" Name="FeatureDefinition/b5934f65-a844-4e67-82e5-92f66aafe912">
<Properties>
<Property Key="DeclarativeWorkflowFeatures" Value="3BC0C1E1-B7D5-4e82-AFD7-9F7E59B6" />
</Properties>
</Feature>
<!--SignaturesWorkflowSPD Feature-->
<Feature ID="{c4773de6-ba70-4583-b751-2a7b1dc67e3a}" Name="FeatureDefinition/c4773de6-ba70-4583-b751-2a7b1dc67e3a">
<Properties>
<Property Key="DeclarativeWorkflowFeatures" Value="A42F749F-8633-48b7-9B22-403B4019" />
</Properties>
</Feature>
<!--TranslationWorkflow Feature-->
<Feature ID="{c6561405-ea03-40a9-a57f-f25472942a22}" Name="FeatureDefinition/c6561405-ea03-40a9-a57f-f25472942a22">
<Properties>
<Property Key="RegisterForms" Value="Forms\*.xsn" />
<Property Key="GloballyAvailable" Value="true" />
</Properties>
</Feature>
<!--Workflows Feature-->
<Feature ID="{0af5989a-3aea-4519-8ab0-85d91abe39ff}" Name="FeatureDefinition/0af5989a-3aea-4519-8ab0-85d91abe39ff" />
<!--IssueTrackingWorkflow Feature-->
<Feature ID="{fde5d850-671e-4143-950a-87b473922dc7}" Name="FeatureDefinition/fde5d850-671e-4143-950a-87b473922dc7" />
<!--WAWhatsPopularWebPart Feature-->
<Feature ID="{8e947bf0-fe40-4dff-be3d-a8b88112ade6}" Name="FeatureDefinition/8e947bf0-fe40-4dff-be3d-a8b88112ade6" />
<!--ICMSv2_Assests Feature-->
<Feature ID="{07bb8c5f-4e8e-47ed-8ac9-a8e38f328d80}" Name="FeatureDefinition/07bb8c5f-4e8e-47ed-8ac9-a8e38f328d80" />
<!--WAMaster Feature-->
<Feature ID="{c04234f4-13b8-4462-9108-b4f5159beae6}" Name="FeatureDefinition/c04234f4-13b8-4462-9108-b4f5159beae6" />
<!--LocationBasedPolicy Feature-->
<Feature ID="{063c26fa-3ccc-4180-8a84-b6f98e991df3}" Name="FeatureDefinition/063c26fa-3ccc-4180-8a84-b6f98e991df3" />
<!--BasicWebParts Feature-->
<Feature ID="{00bfea71-1c5e-4a24-b310-ba51c3eb7a57}" Name="FeatureDefinition/00bfea71-1c5e-4a24-b310-ba51c3eb7a57" />
<!--MobileExcelWebAccess Feature-->
<Feature ID="{e995e28b-9ba8-4668-9933-cf5c146d7a9f}" Name="FeatureDefinition/e995e28b-9ba8-4668-9933-cf5c146d7a9f" />
<!--MobilePowerPointViewer Feature-->
<Feature ID="{893627d9-b5ef-482d-a3bf-2a605175ac36}" Name="FeatureDefinition/893627d9-b5ef-482d-a3bf-2a605175ac36" />
<!--MobileWordViewer Feature-->
<Feature ID="{8dfaf93d-e23c-4471-9347-07368668ddaf}" Name="FeatureDefinition/8dfaf93d-e23c-4471-9347-07368668ddaf" />
<!--PowerPointServer Feature-->
<Feature ID="{5709298b-1876-4686-b257-f101a923f58d}" Name="FeatureDefinition/5709298b-1876-4686-b257-f101a923f58d" />
<!--PowerPointEditServer Feature-->
<Feature ID="{738250ba-9327-4dc0-813a-a76928ba1842}" Name="FeatureDefinition/738250ba-9327-4dc0-813a-a76928ba1842" />
<!--WordViewer Feature-->
<Feature ID="{1663ee19-e6ab-4d47-be1b-adeb27cfd9d2}" Name="FeatureDefinition/1663ee19-e6ab-4d47-be1b-adeb27cfd9d2" />
<!--OneNote Feature-->
<Feature ID="{3d433d02-cf49-4975-81b4-aede31e16edf}" Name="FeatureDefinition/3d433d02-cf49-4975-81b4-aede31e16edf">
<Properties>
<Property Key="NOTEBOOKCSSBASE" Value="/_layouts/inc/{0}Box4/" />
<Property Key="NOTEBOOKSCRIPTSBASE" Value="/_layouts/inc/Box4/" />
<Property Key="NOTEBOOKSCRIPTSLCIDBASE" Value="/_layouts/inc/{0}Box4/" />
<Property Key="NOTEBOOKIMAGEBASE" Value="/_layouts/inc/{0}Box4/" />
<Property Key="SYNCINTERVALMININSECONDS" Value="5" />
<Property Key="SYNCINTERVALMINONHEAVYLOADINSECONDS" Value="30" />
<Property Key="SERVERHEALTHSCOREONHEAVYLOAD" Value="8" />
<Property Key="SYNCINTERVALSTEPINSECONDS" Value="5" />
<Property Key="SYNCINTERVALMAXINSECONDS" Value="60" />
<Property Key="REPLICATIONINTERVALONFAILUREINSECONDS" Value="1" />
<Property Key="REPLICATIONINTERVALSTEPONFAILUREINSECONDS" Value="2" />
<Property Key="REPLICATIONINTERVALSLEEPINGINSECONDS" Value="540" />
<Property Key="SLEEPINTERVALINSECONDS" Value="420" />
<Property Key="NOTEBOOKVERSIONINGENABLED" Value="True" />
<Property Key="MAXMERGEQUEUELENGTH" Value="10" />
<Property Key="TIMEINSECONDSBEFOREALLOWINGOTHERFEHANDLEPERSISTEDMERGEREQUEST" Value="10" />
<Property Key="IMAGECACHEMAXSIZE" Value="50" />
<Property Key="CSAPISPELLINGDLLROOT" Value="Bin" />
<Property Key="CSAPISPELLINGLEXROOT" Value="Bin" />
<Property Key="PROXY" Value="" />
<Property Key="OFFICEONLINECONFIGURL" Value="http://r.office.microsoft.com/r/rlidClientConfig" />
<Property Key="CLIPARTENABLED" Value="True" />
<Property Key="CLIPARTCOMMUNITYSUBMITTEDENABLED" Value="False" />
<Property Key="MAXIMUMREQUESTCOUNTINGROUP" Value="20" />
<Property Key="MAXIMUMDATAELEMENTPACKAGESIZEINBYTES" Value="104857600" />
<Property Key="MAXIMUMDATABLOBSIZEINBYTES" Value="52428800" />
<Property Key="MAXIMUMOBJECTSINREVISIONDOCX" Value="100000" />
</Properties>
</Feature>
<!--ExcelServerSite Feature-->
<Feature ID="{3cb475e7-4e87-45eb-a1f3-db96ad7cf313}" Name="FeatureDefinition/3cb475e7-4e87-45eb-a1f3-db96ad7cf313" />
<!--PremiumSite Feature-->
<Feature ID="{8581a8a7-cf16-4770-ac54-260265ddb0b2}" Name="FeatureDefinition/8581a8a7-cf16-4770-ac54-260265ddb0b2" />
<!--ExcelServerEdit Feature-->
<Feature ID="{b3da33d0-5e51-4694-99ce-705a3ac80dc5}" Name="FeatureDefinition/b3da33d0-5e51-4694-99ce-705a3ac80dc5" />
<!--OfficeWebApps Feature-->
<Feature ID="{0c504a5c-bcea-4376-b05e-cbca5ced7b4f}" Name="FeatureDefinition/0c504a5c-bcea-4376-b05e-cbca5ced7b4f">
<Properties>
<Property Key="CANARYSITEKEY" Value="8CKvuovOW757BhuwMSvQPYEM5g/Y4bX/NlRXa87lVhs=" />
</Properties>
</Feature>
<!--WACustomReports Feature-->
<Feature ID="{af6d9aec-7c38-4dda-997f-cc1ddbb87c92}" Name="FeatureDefinition/af6d9aec-7c38-4dda-997f-cc1ddbb87c92" />
<!--TaxonomyFieldAdded Feature-->
<Feature ID="{73ef14b1-13a9-416b-a9b5-ececa2b0604c}" Name="FeatureDefinition/73ef14b1-13a9-416b-a9b5-ececa2b0604c" />
<!--Reporting Feature-->
<Feature ID="{7094bd89-2cfe-490a-8c7e-fbace37b4a34}" Name="FeatureDefinition/7094bd89-2cfe-490a-8c7e-fbace37b4a34" />
<Feature ID="{3bc0c1e1-b7d5-4e82-afd7-9f7e59b60409}" Name="FeatureDefinition/3bc0c1e1-b7d5-4e82-afd7-9f7e59b60409">
<Properties>
<Property Key="DeclarativeWorkflows" Value="ReviewApproval,Approval - SharePoint 2010,{8AD4D8F0-93A7-4941-9657-CF3706F00409};#ReviewFeedback,Collect Feedback - SharePoint 2010,{3BFB07CB-5C6A-4266-849B-8D6711700409}" />
</Properties>
</Feature>
</SiteFeatures>

<WebFeatures>
<!--WebPageLibrary Feature-->
<Feature ID="{00bfea71-c796-4402-9f2f-0eb9a6e71b18}" Name="FeatureDefinition/00bfea71-c796-4402-9f2f-0eb9a6e71b18" SourceVersion="1.0.0.0" />
<!--IssuesList Feature-->
<Feature ID="{00bfea71-5932-4f9c-ad71-1557e5751100}" Name="FeatureDefinition/00bfea71-5932-4f9c-ad71-1557e5751100" SourceVersion="0.0.0.0" />
<!--WorkflowHistoryList Feature-->
<Feature ID="{00bfea71-4ea5-48d4-a4ad-305cf7030140}" Name="FeatureDefinition/00bfea71-4ea5-48d4-a4ad-305cf7030140" SourceVersion="0.0.0.0" />
<!--NoCodeWorkflowLibrary Feature-->
<Feature ID="{00bfea71-f600-43f6-a895-40c0de7b0117}" Name="FeatureDefinition/00bfea71-f600-43f6-a895-40c0de7b0117" SourceVersion="0.0.0.0" />
<!--SurveysList Feature-->
<Feature ID="{00bfea71-eb8a-40b1-80c7-506be7590102}" Name="FeatureDefinition/00bfea71-eb8a-40b1-80c7-506be7590102" SourceVersion="1.0.0.0" />
<!--GridList Feature-->
<Feature ID="{00bfea71-3a1d-41d3-a0ee-651d11570120}" Name="FeatureDefinition/00bfea71-3a1d-41d3-a0ee-651d11570120" SourceVersion="1.0.0.0" />
<!--GanttTasksList Feature-->
<Feature ID="{00bfea71-513d-4ca0-96c2-6a47775c0119}" Name="FeatureDefinition/00bfea71-513d-4ca0-96c2-6a47775c0119" SourceVersion="0.0.0.0" />
<!--LinksList Feature-->
<Feature ID="{00bfea71-2062-426c-90bf-714c59600103}" Name="FeatureDefinition/00bfea71-2062-426c-90bf-714c59600103" SourceVersion="1.0.0.0" />
<!--MobilityRedirect Feature-->
<Feature ID="{f41cc668-37e5-4743-b4a8-74d1db3fd8a4}" Name="FeatureDefinition/f41cc668-37e5-4743-b4a8-74d1db3fd8a4" SourceVersion="1.0.0.0" />
<!--workflowProcessList Feature-->
<Feature ID="{00bfea71-2d77-4a75-9fca-76516689e21a}" Name="FeatureDefinition/00bfea71-2d77-4a75-9fca-76516689e21a" SourceVersion="1.0.0.0" />
<!--TasksList Feature-->
<Feature ID="{00bfea71-a83e-497e-9ba0-7a5c597d0107}" Name="FeatureDefinition/00bfea71-a83e-497e-9ba0-7a5c597d0107" SourceVersion="1.0.0.0" />
<!--TeamCollab Feature-->
<Feature ID="{00bfea71-4ea5-48d4-a4ad-7ea5c011abe5}" Name="FeatureDefinition/00bfea71-4ea5-48d4-a4ad-7ea5c011abe5" SourceVersion="14.0.0.0" />
<!--AnnouncementsList Feature-->
<Feature ID="{00bfea71-d1ce-42de-9c63-a44004ce0104}" Name="FeatureDefinition/00bfea71-d1ce-42de-9c63-a44004ce0104" SourceVersion="1.0.0.0" />
<!--ObaSimpleSolution Feature-->
<Feature ID="{d250636f-0a26-4019-8425-a5232d592c01}" Name="FeatureDefinition/d250636f-0a26-4019-8425-a5232d592c01" SourceVersion="14.0.0.0" />
<!--PictureLibrary Feature-->
<Feature ID="{00bfea71-52d4-45b3-b544-b1c71b620109}" Name="FeatureDefinition/00bfea71-52d4-45b3-b544-b1c71b620109" SourceVersion="1.0.0.0" />
<!--ContactsList Feature-->
<Feature ID="{00bfea71-7e6d-4186-9ba8-c047ac750105}" Name="FeatureDefinition/00bfea71-7e6d-4186-9ba8-c047ac750105" SourceVersion="1.0.0.0" />
<!--CustomList Feature-->
<Feature ID="{00bfea71-de22-43b2-a848-c05709900100}" Name="FeatureDefinition/00bfea71-de22-43b2-a848-c05709900100" SourceVersion="1.0.0.0" />
<!--DocumentLibrary Feature-->
<Feature ID="{00bfea71-e717-4e80-aa17-d0c71b360101}" Name="FeatureDefinition/00bfea71-e717-4e80-aa17-d0c71b360101" SourceVersion="1.0.0.0" />
<!--DiscussionsList Feature-->
<Feature ID="{00bfea71-6a49-43fa-b535-d15c05500108}" Name="FeatureDefinition/00bfea71-6a49-43fa-b535-d15c05500108" SourceVersion="1.0.0.0" />
<!--DataSourceLibrary Feature-->
<Feature ID="{00bfea71-f381-423d-b9d1-da7a54c50110}" Name="FeatureDefinition/00bfea71-f381-423d-b9d1-da7a54c50110" SourceVersion="0.0.0.0" />
<!--DataConnectionLibrary Feature-->
<Feature ID="{00bfea71-dbd7-4f72-b8cb-da7ac0440130}" Name="FeatureDefinition/00bfea71-dbd7-4f72-b8cb-da7ac0440130" SourceVersion="14.0.0.0" />
<!--ExternalList Feature-->
<Feature ID="{00bfea71-9549-43f8-b978-e47e54a10600}" Name="FeatureDefinition/00bfea71-9549-43f8-b978-e47e54a10600" SourceVersion="1.0.0.0" />
<!--EventsList Feature-->
<Feature ID="{00bfea71-ec85-4903-972d-ebe475780106}" Name="FeatureDefinition/00bfea71-ec85-4903-972d-ebe475780106" SourceVersion="3.0.0.0" />
<!--XmlFormLibrary Feature-->
<Feature ID="{00bfea71-1e1d-4562-b56a-f05371bb0115}" Name="FeatureDefinition/00bfea71-1e1d-4562-b56a-f05371bb0115" SourceVersion="0.0.0.0" />

</WebFeatures>
Article:MOSS 2007 Feature GUID List

Thursday, May 27, 2010

Silverlight security error connecting SharePoint

Scenario:
Wrote a small Silverlight application which was trying to display the title of the site using Client Object Model and to my surprise I got the following error :

{System.Security.SecurityException ---> System.Security.SecurityException: Security error.
at System.Net.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.BrowserHttpWebRequest.<>c__DisplayClass5.
b__4(Object sendState)
at System.Net.AsyncHelper.<>c__DisplayClass2.
b__0(Object sendState)
--- End of inner exception stack trace ---
at System.Net.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.WebClient.GetWebResponse(WebRequest request, IAsyncResult result)
at System.Net.WebClient.OpenReadAsyncCallback(IAsyncResult result)}


Solution:
This can be because of few reasons

1. Make sure the web URL used to create the Client context object exist and brows-able.

2. This might be because of missing client policy access file missing for the SharePoint Web Application not allowing you to connect. Create a new XML file named ClientAccessPolicy.xml with content below and save it to 'C:\inetpub\wwwroot\VirtualDirectories\80'

Note : Update policy file and port number as needed.

ClientAccessPolicy.xml:

<?xml version="1.0" encoding="utf-8" ?> 
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*" />
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true" />
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
Once you have the file copied to right location, do an IISReset and make sure you can access the file using following url :

http://servername:portno/clientaccesspolicy.xml
Note
This setting is only for Development Environment. Read the following article how to tweak the policy file for production environment.

Article:MSDN

Error referencing SharePoint Client DLLs in Silverlight

Scenario:
I build up a new VM and was experimenting with Silverlight and SharePoint. I created a new Silverlight Application Project in Visual Studio. Then I tried adding the client object model dlls.

Microsoft.SharePoint.Client.Silverlight.dll
and
Microsoft.SharePoint.Client.Silverlight.Runtime.dll

located at "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\ClientBin" and surprisingly got this

error sl client

Sometime your project build just fine but you get referencing error at run time, something like this.

error sl client2

Solution:
Two step solution was
1. Copy both the binaries from
"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\ClientBin" to "C:\SilverlightClientOM" folder.

2. Reference from the new folder

Friday, May 21, 2010

SharePoint 2010 Console Application threw FileNotFoundException was unhandled

Scenario:
My colleague called me and asked to look for the error she was getting in her first SharePoint 2010 Console Application.

The Web application at http://demo/ 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.

Solution:
Simple solution, Check to make sure thats Build Target for the Project is x64 and not x86 which is default setting.

1. Right Click the Project Node > Properties
2. Under Build tab > Target should be x64

Also make sure thats there is a site collection at the url you are specifying to create SPSite object

SharePoint 2010 - What I love

SharePoint 2010 has a whole new world and even though Microsoft has flooded us with so much learning material, I am discovering small small new hidden enhancements.

Live preview:
While formatting the text you can see live preview and thus avoid lots and lots of cycles of Save-Publish-Preview. It was a big pain in 2007

Inline Image upload and resizing:
You can now add an new image right into Wiki Page without navigating anywhere unlike in 2007 where you need to upload all images in advance and then use them.Also inline resizing of image is a great new addition to SP2010.

List creation without leaving the page:
Now using the fluent UI , you can create a NEW List without leaving the page and also insert it into the page.

True Versioning:
Now when you edit a page in SharePoint and Versioning is enabled , it retain the web parts added/deleted information also.

Power-shell:
Being a developer at heart its an awesome scripting language to control any part of SharePoint administration.

Visio Services and Image Overlay APIs:
Visio Services JavaScript image overlay allows you to display processes related information no one has though before.

Incoming email with attachment option:
Incoming email with attachment option is enhanced now. Try sending an email to a document library, you will see the attached document posted in the library and if you take a closer look at the information below, you can see that this document is created via email and on clicking hyper link , it will give details of the email message

Feature Event Receivers:
a) Now no need to over-ride all the methods , only the one which you want to implement, much cleaner code as mostly not one has much to do in Feature Installed and UnInstalled events

b) Support for Feature upgrade, you can now have another method in Feature Event Receiver class to handle Feature Upgrade requirements.

No more STP files
Everything is WSP now, STP file extension is gone.

Logging
I always asked myself why Microsoft cant make it easier for Custom Solutions to use the same logging framework they are using themselves. In Sp2010 we can expose Custom Logging Categories as well as we can write custom messages in Developer Dashboard output.

SharePoint Explorer
Visual Studio 2010 has a SharePoint Explorer , to visualize the site collection without opening site collection in Browser and SPD 2010

SharePoint Designer Navigation based on Artifacts
In MOSS SharePoint Designer Navigation was based on URL , so power users need to know where are master pages/pages and other items to be able to edit them. In SPD 2010 , Default Navigation is based on Artifacts and have option for Url based navigation.

Visual Studio 2010 SharePoint Tab
Deployment Configuration will give you great control on how do you want to deploy your solutions

Friday, May 14, 2010

SharePoint 2010 : Development machine

I got a brand new laptop and very powerful one. As its all for SharePoint, here some tips and steps I used to make it ready to ROCK

Hardware Configuration : i7 , 8 GB RAM , 320 GB HDD
OS Configuration : Window Server 2008 R2 Enterprise installed

Step by Step guide
Power
Make sure you have the power source hooked and you are not on battery backup.

Internet
Plug the hard wire for internet, we will use this to download latest hotfixes/patched and other big softwares.

Windows Update and Rebooting
Run the Windows Update and restart once all the updates are installed ( without fail )

Add Features
Desktop Experience
Ink
Quality Window Audio and Video
XPS Viewer

Windows Update and Rebooting
Run the Windows Update and restart once all the updates are installed ( without fail )

Mouse
Plug the USB mouse and make sure it get recognized

Internet Explorer
a) Configure Internet explorer startup settings using Wizard

b) By default Internet Explorer enhanced security is enabled , turn Off for Administrator.
Search for 'Server Manager' > Configure IE ES > select Off for Administrator

c) Change default search provider from BING to what ever u like

Machine Name
Rename machine to a better name before you start using it.

Activate Operating System
Activate the OS before you proceed furthur.

Add Role for Hyper V
Search for 'Server Manager' > Add Roles
Look for Hyper-V and install it
Reboot the machine to finalize the changes

Audio
Search for 'Services'
Look for Windows Audio Service - Set it to Automatic - and Start it.

Resolution
Adjust monitor's resolution so that you can utilize maximum screen space.

Time
Adjust time zone and server to reflect correct values

Drivers
Go to your laptop brand website and search for Support and Drivers
a ) Search for Wireless Drivers - Install it
Reboot the machine and Select your preferred network

b) Dual Monitor - Be careful as Hyper-V has issues with high end drivers and can crash your machine.
If you are confident install the graphic drivers

Command Line
As we will use the command window frequently , Launch cmd and set the font and adjust color to something smoother and better

Folder options
Windows Explorer > Press Alt key to get the File menu
Options > Uncheck Hide know file type ,

Softwares
Virtual PC 2007 -
Visual Studio 2010 - Lauch once and set the Keyboard layout to VB or C#
Install Office 2007/2010 ( 32 BIT please ) and Configure Outlook account

Windows Update and Rebooting
Run the Windows Update and restart once all the updates are installed ( without fail )

Communication
a ) Yahoo Messenger - Configure Alerts and Notification options to avoid surprises
b ) MSN
c) GTalk

Developer tools
Visual Studio 2010
Web Installer 2.0


Other productivity tools
Download Google Chrome - make sure to change the Download folder location
Download Firefox - make sure to change the Download folder location
Acrobat Reader
Adobe Flash
7Zip
Notepad++
Snipper Tool ( Its there actually in c:\Windows\System32 and look for Snipper Tool.exe > Right click to save a shortcut to desktop )