My blog has moved!

My blog has moved to http://www.lamber.info. Click on the redirect button below to be redirected to the blog post.

Please update your bookmarks and use the new url for getting new updates.

Pages

Saturday, June 19, 2010

Silverlight Web Parts made easy with SharePoint 2010 Extensibility Projects

Hi all,

for all of those that didn’t noticed that. Paul Stubbs announced on 26 April 2010 in this post some SharePoint 2010 Extensibility Projects. One of my favorites is the Silverlight Web Part extension that helps you during the creation process of  Silverlight Web Parts in SharePoint 2010.

It’s worth a try,

Patrick

Thursday, June 10, 2010

SharePoint Security 101

Hi all,

today I found a nice article written by Dave Greten that explains the basic idea behind how SharePoint server security works.

An interesting article for all people new to SharePoint.

Best regards,

patrick

Try Office Web Apps for free

Hi all,

Microsoft released for the public the Office Web Apps. The cloud-application can be accessed by everyone for free.

Give it a try,

Patrick

Friday, June 4, 2010

SharePoint 2010: Professional Developer Evaluation Guide and Walkthroughs

Hi all,

you can download for free in the download center of Microsoft the SharePoint 2010 developer evaluation guide and walkthrough documents. The documents give an overview of the functions of SharePoint and how to extend the product. A good way to start and get an overview of the the SharePoint 2010 platform from a developer perspective. You can download the documents here.

Happy downloading,

Patrick

Wednesday, June 2, 2010

Visual Web Parts are cool… but how do I create Visual Editor Parts?

Hi,

in the last post of my post series about Visual Web Part development we saw how we can build Editor Parts for our Web Parts. The main advantage of using Visual Web Parts is the ability of using the Visual Studio 2010 designer to build the Web Part. Why not using the same idea to build Visual Editor Parts?

In this post, I show you in simple steps how to create your first Visual Editor Parts. Our example will only show how to prepare a Visual Editor Part without logic and controls. However, if you know how to do it with classic Editor Parts, it should not be any issue.

Step 1: create a test Visual Web Part project and create a new Visual Web Part with the name VisualEditorPartExample (there are several posts in my post series explaining how to do it). You should see something like that:

image

Step 2: Add a new user control and call it EditorUserControl.ascx

Step 3: The user control is placed automatically in the ControlTemplates:

image

Step 4: We want to put the EditorUserControl.ascx in the same container as our Visual Web Part (in our case VisualEditorPartExample). Simply drag & drop the user control EditorUserControl.ascx in the VisualEditorPartExample folder. It will look like next picture:

image

Step 5: To finish this configuration we are going to change the Deplyoment location path property of the EditorUserControl.ascx. Currently, the path value is composed by {ProjectName}\{Visual Web Part Name}. However, we want to change it to reflect the same path of our Visual Web Part. To do this, we only need to add the CONTROLTEMPLATES folder in front of our path. In our case we change the property from Lamber.TestPart\VisualEditorPartExample\ to CONTROLTEMPLATES\Lamber.TestPart\VisualEditorPartExample\. You can see the property change in the next figure:

imageUntil now, we only added an user control to the project and configured it to be deployed in the same folder of our Visual Web Part. This user control will be used to create the visual logic for our Editor Part. We do normally the same with our Visual Web Parts. However, we did not create any Editor Parts yet. Let us do it immediately…

Step 6: Add a new class VisualEditorPartExample container and call it EditorPartExampleEditor.cs. This will be our old school Editor Part controlling the storage of properties with the synch and apply methods. In addition, this class is responsible to load the user control that we created before. The code of the Editor Part may look like in the next code snipped:

namespace Lamber.TestPart.VisualEditorPartExample
{
class EditorPartExampleEditor : EditorPart
{
// Visual Studio might automatically update this path when you change the Visual Web Part project item.
private const string _ascxPath = @"~/_CONTROLTEMPLATES/Lamber.TestPart/VisualEditorPartExample/EditorUserControl.ascx";

protected override void CreateChildControls()
{
Control control = Page.LoadControl(_ascxPath);
Controls.Add(control);
}

public override bool ApplyChanges()
{
// put the applychanges code here
return true;
}

public override void SynchChanges()
{
// put the synchchanges code here
}
}
}

The important lines lie between 6-12, where we are going to load the user control EditorUserControl.ascx in our Editor Part. You see, that this is the same logic used by the Visual Web Parts. Please note that the example above adds no logic to this Editor Part.

Step 7: Finally, we have only to add the Editor Part reference to our EditorPartCollection of our Visual Web Part. Change the code of the VisualEditorPartExample.cs like in the code snipped below:

public override EditorPartCollection CreateEditorParts()
{
EditorPartExampleEditor editor = new EditorPartExampleEditor();
editor.ID = this.ID + = "_example";

List<EditorPart> collection = new List<EditorPart>();
collection.Add(editor)

return new EditorPartCollection(collection);
}

 

Summary

That’s all, deploy the project and test your freshly created Visual Editor Part. Naturally, you have to add the logic and connections with the personalization properties. You might find hints how to do it in my last post. However, I think that the idea is somehow clear and easy to follow.

 

Happy coding,

Patrick