Archive for the ‘code’ Category

Last week someone had ask me for some tools and good resources for helping him with his old sharepoint projects that were not yet migrated.

I had send him back the list of resources i8 had been using and some developments where i had collaborate. So here it goes some of the best references for you to use  on your projects. Some of them are also a good choice when used in Sharepoint 2013

Untitled

 

SPSite Lokup
-> http://sp2010filteredlookup.codeplex.com/

Multiple providers Authenticattion
->http://spautomaticsignin.codeplex.com/
->http://sp2010fba.codeplex.com/

sharepoint search xslt configurations
->http://sharepoint2010search.codeplex.com/
sandboxes
->http://sandbox.codeplex.com/
Taxonomie deploys
->http://termsetimporter.codeplex.com/

 

development frameworks
->http://spgenesis.codeplex.com/
developer dashboard
->http://devdashvis.codeplex.com/

start and stop Sharepoint
->http://sharepointserviceman.codeplex.com/

Google analytics integration Sharepoint
->http://spgoogleanalytics.codeplex.com/

Newsletter Generator
->http://spmailing.codeplex.com/

sharepoitn factory

http://spsf.codeplex.com/

Tools for kick solutions satartup
http://spc3.codeplex.com/

 

I hope this information can be so useful for you, as it had been for me in the last years

Thanks to http://chanakyajayabalan.wordpress.com i had found a useful step by step how to build a costume Membership and Authentication provider for Sharepoint.

This kind of customization is very useful in extranets and website with a restricted area that goes outside the AD boundries. In fact in the past days i had my self to do a concept proof of integration between Sahrepoint 2010 and outsystem for a client my and if i had this information it could be quickly to implement.

So many thanks to the Chanakya Sharing and below you have the links

Part 1,
Part 2

Part 3,
Part 4

Just a quick note:

This implementation is for Moss 2007 but is equal when you pretend to use Forms authentication.If you want to create Forms authentication with Claims then you should find another kind of resource like http://msdn.microsoft.com/en-us/library/gg317440.aspx

Some advices:

If you are creating a forms authentication and have no schema or User’s (directory, bd what ever) source, it may be useful to use the ASP.NET Form’s authentication method you can find how in http://www.codeproject.com/Articles/352841/How-to-Configure-Form-Based-Authentication-FBA-in and for management of the user’s you can use the following artifact http://sharepoint2010fba.codeplex.com/ or http://fba.codeplex.com/

If you want some code that refer to the FBA Claims to explore you can get two interesting examples in http://sp2010claimsfbaexs.codeplex.com/

Do you know what to do when we need to make a deploy specific to the style library or other logical folder of sharepoint 2010?

The solution is pretty simple but for most is not obvious so here goes the simple steps:
1- Create a Feature
2- Copy the resources to your feature folder
3- In the manifesto of your feature instantiate a module and define something similar to

The File element defines the resource to copy.
The url of the element indicates the destiny of the copy
The Path indicates the origin of the copy
Pay attention to what you choose in to the Type becouse here you can define if you intend to make the element ghostable or not.

I am working in the Sharepoint development from more than 6 years, first as developer then as a software architect now as teacher and Technical mentor and Technical Leader, and one-off the things that always make the developers shy is when we say “and if we build our own Sharepoint field”.

Look’ s like we are talking about black magic, the true is that building a field and have the knowledge to do that is the base to build yourself as a good Sharepoint developer because if you understand the “magic” behind this task you understand the way Sharepoint works. The  true is that you don’t have a lot of explanation about this topic on books or training classes.

In this post i will try to explain you the art of building a custom Field, and explain each need and step to achieve the goal of creating a custom field.

In our example we will build a field that will allow a sharepoint user to define the elements of a list that should appear ( a kind of multiplelookupfield but made based on a variationroot site). Since nowadays almost developers are using visual studio we will use the visual studio 2010 as our development tool.

Let’s start by creating a new empty SharePoint project in Visual Studio 2010

After that we should start to create the struture of our project according to the needs of our field. start by creating a mapped folder to the ControlTemplates Sharepoint Folder that is the place where User Controls of the Sharepoint Fields are deployed. Then create a mapped folder to the XML folder, this folder is where Sharepoint stores the definitions of the different elements that are recognized as part of the framework. In some cases You may also need to Map the XSLT folder typically when you have the need or will to use a transform to Generate the forntEnd of your control.

After the creation off our project structure let’s start by specifying our field definition. In sharepoint whenever you need to define a new type (and that is one way to see a Field in the sharepoint world). To do that we need to create a xml file in the mapped folder XML (that will be deployed by the WSP Solution to SharePointRoot\Template\XML), the file should be named as fldTypes_*.xml. The files from the SharePointRoot\Template\XML are read by the runtime at the sharepoint starts or whenever the application pool is started. This file is also used This file is used during list creation to define how field types are rendered in one or more of the different modes for viewing list data (more about this topic in   MSDN ).

Is int this file that the magic begins to be created let’s take a look to understand the meaning of each entry.In the TypeName we define the Name of the new Field Type. The ParentType defines the base type of sharepoint form where the new fields inherits functionality. the TypeShortdescription is the description definition that will appear at the sharepoint backoffice when the Sharepoint administrator Choose the field. UserCreatable defines  if the user can create or not new instances of the field. The FieldTypeClass defindes the server side implementation of the field.

After defining or Type, what had ben done in the creation of the file fldTypes_SPListItemSelectionField.xml let’s start by implementing the class that defines the behaviour of the field. for that intent let’s add a new cs file to our project with the follow name ItemListSelectionField.cs. In that file let’s declare the call ItemListSelectionField that inherits from SPTextFied as suggested in the Field definition written above.

The class has SPFieldText as is base class since we want to extend from this Field Type. Typically when defining a new field we need to override two methods the FieldRenderingControl and the GetValidationString (we have defined the second one only for demonstration proposes).

The GetValidatedString is responsible for returning the expression that validates our field imagine in cases like an email or others.

The FieldRenderingControl returns the control that is responsible for the rendering of the Field. In our case we are creating a new instance of the of The SPItemListSelectionFieldControl that is our user control. After the implementation of the class that defines our field and to define or field against sharepoint using the field definition file, we should define the way our field render himself.

The easiest way to do that is to use a ASP.NET UserControl, so let’s create a new User Control in the mapped folder ControlTemplate.

As you can see is a normal ASP.NET User Control we have deleted the assembly reference from the ascx since we will delete the class generated by visual studio for code behind to create our own class. In the Code present you can see we have two repeater a first to be used in the edit mode to show the different options of the list we can select and a second one that shows the different user choices separed by the character “;”.

As base class we have consider the BaseFieldControl class. The BaseFieldControl is a Sharepoint Class that defines the behaviour of every Sharepoint Field Controls.  We have override the CrateChildControls method since we have the specific controls present in our ascx file and we have the need to populate/manipulate them. We have also override the DefaultTemplateName this method is responsible for the return of the ID of the SharePoint:RenderingTemplate control that contains the actual implementation of the user interface. and then we also have the need to define the way the value is stored in our field and presented.  Let´s take a look

The way this property works can be a little tricky, the set is called when ever the field is saved and the get whenever the control is rendered.

After this we can build our code and deploy our solution to the Sharepoint farm, and this are the explained needed steps to build your own Sharepoint Field. This is an important knowledge when you really want to customize the types of data you receive from user and to build complex fields. Hope this post is helpful feel free to ask. I will post all the code with is explanation later on codeplex.