Donnerstag, 7. Juli 2011

Add customaction to ribbonbar in sharepoint 2010 wiki page

Just a simple copy & paste of a custom action that adds a button to the ribbonbar in a publishingpage in the pageslist of a wiki-site:

<CustomAction Id="WikiDocumentExportCustomizationPageView" Rights="Contribute" Location="CommandUI.Ribbon" Sequence="30" Title="Wiki-Document-Export"> 
 <CommandUIExtension> 
  <CommandUIDefinitions> 
   <CommandUIDefinition Location="Ribbon.WikiPageTab.Share.Controls._children"> 
    <Button Id="WikiDocumentExportCustomizationPageView.Button" Command="ExportCurrentWikiDocumentFile2" CommandType="General" Description="Export Wiki-Document" TemplateAlias="o1" Sequence="30" Image32by32="/_layouts/images/wiki/pdf_export.png" LabelText="Export Wiki-Document"/> 
   </CommandUIDefinition> 
  </CommandUIDefinitions> 
  <CommandUIHandlers> 
   <CommandUIHandler Command="ExportCurrentWikiDocumentFile2" CommandAction="javascript:ExportCurrentWikiDocumentFile('{SiteUrl}');"/>
  </CommandUIHandlers> 
 </CommandUIExtension> 
</CustomAction>

Pay attention that this button is only visible to users with contribute-rights on the list.
ExportCurrentWikiDocumentFile is a custom external javascript-function that implements the code behind the button. You must define your own function here...

Freitag, 24. Juni 2011

Good example for a custom service application

Check out chapter 9 of the book Microsoft SharePoint 2010 Web Applications: The Complete Reference, there is a really good example how to create a custom service application. The described scenario creates a translation service and a webpart that's using it.

But be aware of a little error on page 199, change this line

public string AlternativeLanguage { get; set; }

to 
[Persisted] private string _alternativeLanguage;

public string AlternativeLanguage
{
   get { return _alternativeLanguage; }
   set { _alternativeLanguage = value; }
}

or otherwise no change of the Alternative Language would be stored.

Freitag, 17. Juni 2011

Free alternative for .net Reflector: ILSpy

Because of the fact that the most valueable tool in the SharePoint-World beside SharePoint Manager (I mean our beloved .net Reflector) is no longer free and becomes unsusable after a few weeks until it looks for updates, some resourceful developers started writing an open source equivalent, which can be found at:

http://wiki.sharpdevelop.net/ILSpy.ashx

I downloaded and tested it already and I think, it's really advanced for the short time elapsed since its development started in february 2011. The look and feel is very similar to .net Reflector and you definitely should give it a try.

Montag, 2. Mai 2011

CustomAction in ribbonbar doesn't appear for contenttype

Recently I wanted to add a contenttype-specific custom action to the ribbonbar of a document-library. But the button didn't appear. After a short time of verifying and comparing IDs with SharePoint manager, I found the issue:

GuidGen in Visual Studio created me this GUID: 717EE0C46890438e8E245E7D4B4B7438 which I used for the sitecontenttype inheriting from document (0x010100). Then the list instance creates a listcontenttype from this and appends its own GUID. But the ID from the listcontenttype is 0x010100717EE0C46890438E8E245E7D4B4B743800E57C8E7D4D7D024C9A357907E925F14B.

So what's the difference between the root? Its the lower case character 'e'. It seems as if SharePoint would have a problem with case-sensitivity. Since I changed the lower 'e' to an upper 'E' in my sitecontenttype and customaction, the button is visible now.

So please pay attention for lower case characters and replace them when generating Guids with VisualStudio GuidGen.

Montag, 28. März 2011

Dienstag, 22. März 2011

Exam 070-573 passed!

I successfully finished this exam yesterday and may entitle myself TS: Microsoft SharePoint 2010, Application Development. Hooray!

Although it's commonly said, 070-576 is the more complex exam, I personally felt the TS-exam the harder one.

Now I'm awaiting for the MCPD: SharePoint Developer 2010 status set by Microsoft...

Mittwoch, 16. März 2011

No two choices should have the same ID

In any case avoid create different fields with the same Guid OR - and this is important - the same internal name.

This is never checked by the solution packaging mechanism or while adding or installing the solution to the solution store. The errormessage "No two choices should have the same ID" occurs, if you for e.g. try to add an existing field to a sharepoint list.

Be sure to check this from time to time during development-process and before setup your solution to the production server. If the system is up and running, it's very difficult to do changes here...