Feeds:
Posts
Comments

Archive for March, 2010

SharePoint & Office Conference 2010 in Milan

Howdy,

This is a live blog post from the current talk Jan Tielens is giving. I’ll give  you the quick topics.

There exists a basic SL Web Part, that can display any SL application delivered as .xap (and accessible via a URL, of course).

Most important property of it: You can set a .XAP file’s URL.

How it is done:

  1. Upload a .XAP to a document library(Shared Documents)
  2. Copy the URL of the .XAP
  3. Insert the SL Web Part from “Media and Content” area
  4. Paste the URL into the Web Part
  5. Set the Web Part’s width to variable (not fixed), otherwise it’ll issuean error

How to Deploy

1. Virtual File System

  • Add module item (Add –> New Item)
  • Past the .XAP into the module (Elements.xml will now contain a ref to the .XAP)

2. Physical File System

In the 14\TEMPLATE\LAYOUTS folder

  • 15\TEMPLATE\LAYOUTS\ClientBin (default)
  • Advantage: Becomes available right away!

3. Solutions:

  • Add a mapped folder (e.g. above mentioned LAYOUTS) to the solutions
  • Copy .xap into it

Important: For sandboxed solutions, only deployment to VFS is possible.

Client Object Models

Definition: Simple API to add, Retrieve, Update and Manage SP data

DLLs are location in the 14\TEMPLATE\LAYOUTS\ClientBin folder

How to Build Silverlight Web Parts

Create a new project (SL enabled), and put the following code snippets into a User Control.

Add a reference to the Microsoft.SharePoint.Silverlight*.dll files.

Data Binding is done like this in SL:

   1: <DataTemplate>

   2:     <TextBlock Text="{Binding Title}"></TextBox>

   3: </DataTemplate>

Snippet 1: Basic data binding in SL

   1: using (ClientContext ctx = new ClientContext("http://urlToSharePoint"))

   2: {

   3:     items = ctx.Web.Lists.GetByTitle("Videos");

   4:     ctx.Load(items);

   5:     ctx.ExecuteQueryAsync(Success, Fail);

   6: }

Snippet 2: Using the Client Object Model API. Success and Fail are callback methods you have to define. items is a ListItemCollection you’ll have to define in the user control as  a member variable.

As we saw yesterday at an in-depth look of the Client Object, you can also retrieve

Next, marshall the thread from the UI back (in Success/Fail)

   1: this.Dispatcher.BeginInvoke(() =>

   2: {

   3:     //Here we can work with the list items

   4:     foreach(ListItem item in items)

   5:     {

   6:         //Do sth, e.g. add new items

   7:     }

   8: }

Snippet 3: dispatcher invocation

Jan goes one step further and displays the playing of videos by putting a <MediaElement> into the XAML.

Customizable SL Web Parts

The advantage over the Out-of-the-Box web part is that you can add customization value to it:

E.g. adding own properties

BTW: Parameters are passed to SL web parts using the initParams

   1: <param name=’initParamsvalue=’docLib{0}’/>

Snippet 4: Replace {0} with you custom property name, or make it a String.Format!

These can be accessed in Application_Startup method of theSL App like this:

   1: e.initParams("docLib")

Snippet 5: Accessing the initParams
You can also run your SL app outside the browser. You can do this by going to your project’s SL tab and setting the “Run out of the browser” checkbox. This enables your webpart to be downloadable to the client and be executable as a client app!
Keep going, Jan!

Cheers,

Martin

Advertisements

Read Full Post »

Howdy folks,

We’ll have to make this a quick post, since I am only on for a 15 mins break at the SPOC 2010 conference ;-). I prepared a few things, and now I am putting them together.

First of all, I hope you enjoy as much as I do the concept of having VHDs under Windows 7. For those who don’t know where to get started, go to Computer –> Manage –> Disk Management (shown in Figure 1)

image

Figure 1: Disk management. Right-click in order to create or attach VHDs.

And this is where the problem resides. Everytime you want to mount your disks, you have to enter here and execute “Attach Vhd” manually. Not cool enough for us.

The solution: A script, executed as scheduled task (run as Administrator)

These are the steps:

  1. Create a script that calls the diskpart commands
  2. Call the script from a batch file
  3. Create a scheduled task for it.

Sounds simple? It is!

1. Create a script that calls diskpart commands.

image

Figure 2: The attachScript.txt script file.

2. Call the script from a batch file

image

Figure 3: The corresponding batch file: Just calling diskpart with the /s switch and the script file from Figure 2

3. Create a scheduled task for it

image

Step 1: Start –> Accessories –> System Tools –> Task Scheduler

image

Step 2: Set the following fields (Tab: General):

  • Name: Choose what you like. Here: “Mount Vhds”
  • Security options (1): Change User or Group –> Choose an Administrator!
  • Security options (2): Run whether user is logged on or not – makes sense. We don’t need the admin to be logged on for us to access our Vhd, right?
  • Security options (3): Do not store password. You can optionally set this.

image

Step 3: Set “Begin the task” to At startup. Now our task will run at startup.

image

Step 4: Specify which file to run (our created batch/AttachVhds.bat). Confirm by clicking on OK.

That’s it! We’re done! From now on, each time we start the computer, our created task will run!

Important: This is not the most elegant way of automating such a thing, but at the moment there is not a lof of choice under Windows 7. For Windows Server 2008 R2, you can also perform this functionality using PowerShell (and not diskpart/batch files etc.).

I hope you enjoyed this quick tutorial!

Cheers & best greetings from Milan,

Martin

Read Full Post »

Hi all,

Patrick and I are going to attend this year’s SharePoint & Office Conference 2010 in Milan. A look at the possible streams turned out there will be a lot of interesting talks about SP2010’s new features and in-depth look on how to use or program them.

If possible, I’ll try to give you live blogging  information from there (probably w/ focus on programming SP).

SharePoint & Office Conference 2010 Milan

Best regards,

Martin

Read Full Post »