Missing Create Guid in Visual Studio 2010 Beta

by Tycho Bizot 3. December 2009 16:35
For some reason i'm missing the "Create Guid" tool in my VS2010 tools menu. My first thought was that it might had something to do with the "profile" i choose when i first started Visual Studio. So i tried to manually add the Guidgen.exe as an external tool, but i coulnd't find it anywhere.
Guidgen.exe is supposed to be found under \Microsoft Visual Studio 10.0\Common7\Tools but isn't anywhere on my system disk.
When installing VS2010 Ultimate Beta 2 i deactivated some options like C++ and F# to save diskspace. So i fired up the Visual Studio installer to see if i've deactivated "tools" or something as well. Turns there isn't an option like that...
 
Not wanting to spend to much time on it i just created a single line console application and added it manually. If anyone noticed a missing Create Guid tools as well, leave a comment..

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

2010 | Software Development | Tools

SharePoint Client Object Model for Silverlight

by Tycho Bizot 29. November 2009 20:48

The new 2010 version of SharePoint has a so called Client Object Model which you can use in your Silverlight applications. It also comes with a simple webpart that allows you to show a .xap file stored in one of your document libraries.

Someone recently asked me if i still programmed for Silverlight, which i haven't done for a while since combining Silverlight and SharePoint was far from perfect. So i decided to create a simple Silverlight application to see how this Client Object Model works, the applications goal was to enumerate all lists of a specific type on my SharePoint installation.

In Visual Studio 2010 Beta i started a new Silverlight application and dropped a few controls on the drawing canvas. The last time i've been working with Silverlight it only had a few controls and everything had to be done in the xaml code, the designer in Visual Studio couldn't be used for xaml at that time.

To use the client object model you need to reference two files: Microsoft.SharePoint.Client.Silverlight.dll and Microsoft.SharePoint.Client.Silverlight.Runtime.dll . Both files can be found under %SHAREPOINTROOT%\TEMPLATES\LAYOUTS\ClientBin\ .
Directly after adding these files i stumbled upon the first problem. VS2010 showed an exclamationmark next to the references and complained that it couldn't find the files. It turns out that VS2010 Beta has a problem with long file paths, so moving the project closer to the root and reopening it solved the problem.

After the references are added the client object model is available for use. You can create a new ClientContext passing the url of your SharePoint site and start accessing webs,lists etc.
When your application is complete just upload the .xap file to a document library and add a Silverlight webpart to your page, mine looked like this:  

 

Now i just need some design skills :)

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

2010 | Software Development | SharePoint | Silverlight

Enabling the developer dashboard

by Tycho Bizot 29. November 2009 17:12

SharePoint 2010 has a new developer dashboard that, if enabled, renders a lot off usefull information below the normal site contents.
There are a few ways to enable the developer dashboard:

  • Stsadm –o setproperty –pn developer-dashboard –pv ondemand (or “on” or “off”)
  • using PowerShell
  • using the object model.

Since the webpart from my previous post "needed" to do something "usefull" i went for the last option.

Only a few lines off code are needed to enable/disable the dashboard. The OnDemand setting set below adds a small button to the top right side of your sharepoint side to toggle the dashboard on/off.

SPWebService ws = SPWebService.ContentService;
ws.DeveloperDashboardSettings.DisplayLevel =
SPDeveloperDashboardLevel.OnDemand;
ws.DeveloperDashboardSettings.Update();

Seems simple enough, but after pressing the Update button on my webpart i received a Security Exception, even if wrapped inside SPSecurity.RunWithElevatedPrivileges .

I started doubting myself and turned to Google who led me to a Technet post explaning that this is by design:

"NOTE:  This code will not work in a web part if the web part is hosted in any site except the central admin site.  We specifically check for and block that scenario because the developer dashboard is a farm-wide setting.  If you code it up in a web part and try to execute it in a non-central admin site, it will throw a security exception"

So i changed the target site on the webpart project and deployed it to the Central Administration, added the webpart and it worked right away.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

2010 | Software Development | SharePoint

Visual Webpart and Sandboxed Solutions

by Tycho Bizot 29. November 2009 13:16

I just fired up Visual Studio 2010 Beta and started the wizard to create a new Visual Webpart project for SharePoint 2010.
SharePoint 2010 has the new concept of Sandboxed Solutions, but this options is greyed out.

After choosing for the "Farm Solution" option a quick look at the code reveiled why a Visual Webpart can't be a sandboxed solution. The wizard creates a usercontrol and a webpart that loads this usercontrol, just like most developers have been doing for a long time.

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

The call to this.Page.LoadControl() can only function if the code is fully trusted, so this would never work if it was a sandboxed solution.

Looking at the code you'll also see there's no need to add ajax fixes anymore, you can just add updatepanels etc since webparts are now ajax enabled out of the box.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

2010 | Software Development | SharePoint

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen