only My site

Wednesday, November 14, 2012

C# - Extension methods

Extension methods are new features of c# 3.0 compilers and it is available in all the versions greater than 3.0. Extension methods enable you to "add" methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type. Extension methods are a special kind of static method, but they are called as if they were instance methods on the extended type. For client code written in C# and Visual Basic, there is no apparent difference between calling an extension method and the methods that are actually defined in a type.

namespace ExtensionMethods
{
    public static class MyExtensions
    {
        public static int WordCount(this String str)
        {
            return str.Split(new char[] { ' ', '.', '?' }, 
                             StringSplitOptions.RemoveEmptyEntries).Length;
        }
    }   
}
The WordCount extension method can be brought into scope with this using directive:

using ExtensionMethods;

And it can be called from an application by using this syntax:

string s = "Hello Extension Methods";
int i = s.WordCount();

In your code you invoke the extension method with instance method syntax. However, the intermediate language (IL) generated by the compiler translates your code into a call on the static method. Therefore, the principle of encapsulation is not really being violated. In fact, extension methods cannot access private variables in the type they are extending.

Export and Import webparts programmatically

Recently I was given a assignment to import webparts to the existing sharepoint sites. I had searched some code in Google and found some links.

The following are the useful links for the export, import and connect webparts.

http://sharepoint.infoyen.com/2012/03/13/export-and-import-webparts-programmatically/
http://sharepoint.infoyen.com/2012/03/13/connect-webparts-programmatically-using-spconnectwebparts/

SPContnt.aspx - Manage wepparts in a page


Sometimes we need to manage(close, reset and delete) the existing webparts in the SharePoint page, but we could not use the EDIT page option (due to the exception issues in the wep parts). This is an application page called SPContnt.aspx. It takes one parameter url (full or relative path of the page) in the query string. So It would look something like

http://server/site/_layouts/spcontnt.aspx?url=http://server/site/default.aspx



This brings you to a page that will allow you to Close, Reset, and Delete Web Parts from the page.

Sunday, November 11, 2012

Wednesday, November 7, 2012

Useful Links


Youtube Sharepoint Interview Videos
What's New in Sharepoint 2010

What is sharepoint 2010 , sharepoint foundation 2010 and sharepoint server 2010 ?

Interview with Andrew Connell on SharePoint 2010

Professional SharePoint 2010 Development

jQuery Library for SharePoint Services
http://spservices.codeplex.com/documentation

CEWP
http://blogs.msdn.com/b/ecm/archive/2010/04/12/variations-in-sharepoint-2010-connecting-people-with-content.aspx
http://hermansberghem.blogspot.com/2009/10/best-practices-to-build-multi-lingual.html
Page Layout - Step by step with screenshots

http://ukreddysharepoint2010.blogspot.in/2012/07/how-to-create-page-layout-in-sharepoint.html

CQWP

http://sharepointroot.com/2011/06/03/cqwp-with-more-than-three-filters/

http://www.mysticslayer.com/?tag=cqwp

Pagination - http://blog.mastykarz.nl/sharepoint-2010-content-query-web-part-paging/

CQWP Date format
http://blogs.msdn.com/b/joshuag/archive/2009/03/25/custom-date-formats-in-sharepoint-xsl.aspx

disable-output-escaping attribute.
http://blogs.msdn.com/ben_hickman/archive/2009/05/22/content-query-web-part-example.aspx

XSLT template
http://blog.mastykarz.nl/generating-short-description-content-query-web-part/

Newsgator
http://youtube.com/newsgatortv

ZIP Solution

This article starts with a look at different ways to create ZIP files in an ASP.NET application, but then focuses on using the free and open-source DotNetZip library.

http://www.4guysfromrolla.com/articles/092910-1.aspx

K2 - Learn K2 Studio

http://www.k2underground.com/blogs/howtok2/archive/2009/06/15/learn-more-about-k2-studio.aspx

Mobile Development
------------------
http://www.sencha.com/products/touch/download/2.0.1.1/

http://lifehacker.com/5587260/how-to-test-drive-android-on-your-pc-without-buying-a-phone

Infopath Integration

http://www.youtube.com/watch?v=rx3Y-c6D_7k

Sharepoint

New Events and Web Provisioning

http://blog.qumsieh.ca/2010/10/07/how-to-attach-an-event-receiver-to-the-web-added-event-and-for-what-purpose/

http://stefan-stanev-sharepoint-blog.blogspot.in/2010/09/webprovisioned-event-receiver-practical.html

http://msdn.microsoft.com/en-us/library/ee539050(v=office.14).aspx

SharePoint code library (Object model, COM...)
http://sampathnarsingam.blogspot.in/
http://www.sharepointbasic.com/

----------------------------------------------------------------------------------------------
Multilingual

http://blogs.technet.com/b/stefan_gossner/archive/2011/11/22/sharepoint-variations-the-complete-guide-part-7-variation-hierarchy-creation.aspx
http://virtualizesharepoint.com/2011/07/21/installing-language-packs-for-sharepoint-2010/
http://www.microsoft.com/en-us/download/details.aspx?id=12250
http://smallcitydesign.com/direct-links-sharepoint-2010-language-packs/
Downloads (file://INP-303344-2/softwares/Downloads)
System error 53 has occurred. The network path was not found.

E:\Projects\Rexel\softwares\Downloads
Multilingual
--------------
Site definition
http://blog.mastykarz.nl/creating-multilingual-site-definitions-visual-studio-2010-sharepoint-development-tools/
USing resource .resx
http://chakkaradeep.com/index.php/sharepoint-2010-working-with-resource-files/
CQWP http://blogs.msdn.com/b/yojoshi/archive/2012/04/29/localizing-cqwp-contentbyquery-web-part.aspx
Now you can implement variations as same as in MOSS 2007 , for more information : http://office.microsoft.com/en-us/sharepoint-server-help/create-a-variations-site-HA101790173.aspx
Deploy Language Packs: http://technet.microsoft.com/en-us/library/cc262108.aspx
Plan for multilingual user interfaces : http://technet.microsoft.com/en-us/library/ff805087.aspx

Language offerings for SharePoint 2010 : http://blogs.msdn.com/b/sharepoint/archive/2010/05/13/language-offerings-for-sharepoint-2010-products.aspx
Language Packs for SharePoint Foundation 2010 :
http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=646e311a-aaf3-4d30-b03c-2f3c70d19a22
A complete training about Variations : http://blogs.technet.com/b/stefan_gossner/archive/2011/11/14/sharepoint-variations-the-complete-guide-part-1-the-basics.aspx
Installation of language packs
http://virtualizesharepoint.com/2011/07/21/installing-language-packs-for-sharepoint-2010/

Extracting language pack exe files
http://blogs.msdn.com/b/sumanc/archive/2012/03/06/how-to-get-and-install-sharepoint-2010-language-packs.aspx
C:\Users\Administrator\Desktop\ServerLanguagePack.exe /extract:c:\test
Multi lingual user interface: the language of for instance the Ribbon changes due to language packs but the content actually remains the same.
Multi lingual sites: the content is translated by a human translation process and a workflow.
The variations feature is an infrastructure plumbing feature to enable multi lingual sites, nothing more. The role of language packs is to provide the user with a translated GUI. The packs are fairly huge and if you are hosting a large number of languages take that into account.
So the planning considerations are basically around: language packs, information architecture (storage design), hierarchy creation, navigation, redirection logic, client language selection and translation.
language packs, information architecture (storage design), hierarchy creation, navigation, redirection logic, client language selection and translation.
Site hierarchy
For each language (label) a new site is created under the variation root (most cases this is Home). Each label contains the content for that language. To start with you will have to configure the variations settings: a new redirect .aspx at the root. Next you will have to create the variations labels like en-US, es-ES, de_DE, mobile and so on. Set en-US as source. Next, create the variations hierarchy: sites and pages are created. So when you create a new source page they will get created at each variation site till they get approved.

http://geekswithblogs.net/venkatx5/archive/2010/12/14/how-to-create-multilingual-webpart-in-sharepoint-2010.aspx
 

Friday, November 2, 2012

Monday, October 29, 2012

Dynamic Content Editor Webpart

We can assign the Content link to a content editor webpart dynamically using contentlink property. Also we can create the html content dynamically and assign to a Content Editor Web part dynamically using Content property.

string siteURL = default(string);

try{
siteURL =
SPContext.Current.Web.Url;ContentEditorWebpart1.ContentLink = siteURL +
"/ChairmanMessage.html";
XmlDocument xmlDoc = new XmlDocument();XmlElement xmlElement = xmlDoc.CreateElement(
"EditorContent1");xmlElement.InnerText =
"<HTML><iframe id=ifrm width=100% height=345 src='" + "http://google.com" + "' width='Size' height='Size' marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=1 scrolling=no></iframe></HTML>";ContentEditorWebpart2.Content = xmlElement;
}

catch (Exception exp){

   throw exp;}