The SharePoint Coffee House
I'd like some SharePoint with my coffee please...

FYI: Office Web Components Not Supported in SharePoint 2010

Friday, 8 July 2011 08:05 by Michael Mukalian

I was pulling out my hair (figure of speech as I don't have any, ha!) trying to find information around this, and, as is the case pretty much all the time, the second I post a question to the SharePoint forums, I find it on my own.  So lesson learned: whenever you want to find something, ask the question to the masses, then you'll find it right after you ask the question.  Now, onto the "meat" of this post.

When SharePoint 2007 came out, there were a lot of folks that were using the Office Web Components in their SharePoint 2003 implementations, and they wanted to use them in '07.  There've been many an article written on how to do the installation in '07 (like this one here) that walked you through the steps necessary (as it's not just "install-and-go") and I was looking for information that stated whether this was supported or not for SharePoint 2010.

Lo-and-behold, buried in the Changes from Office SharePoint Server 2007 to SharePoint Server 2010 TechNet article, in the Features removed from SharePoint Server 2010 section, it's explicitly called out.  The excerpt related to OWC is below:

*****
Office Web Components
Description
: SharePoint Server 2010 no longer supports Office Web Components (OWC). The PivotChart, PivotTable, and Trend Chart report types are no longer available as options in the SharePoint Dashboard Designer.
Reason for change: This is a 2007 Microsoft Office system feature that is now replaced by the features available in Excel Services in Microsoft SharePoint Server 2010 in SharePoint Server 2010.
Migration path: In SharePoint Server 2010, use Excel Services instead of Office Web Components.
*****

So, per the Microsoft documentation above, these components are *not* supported for SharePoint 2010 implementations.

Now, as these have been considered deprecated for a while, you've already started moving off these and onto Excel Services, right...?

- M

Currently rated 3.0 by 10 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories:   2010 | Development
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

DevReady: SharePoint! Friday, June 3rd, 2011

Tuesday, 10 May 2011 09:54 by Michael Mukalian

We're going to have our first DevReady event for SharePoint on June 3rd.  These events facilitate getting back to the basics around development and the next one is focused on SharePoint.  This is a free event that all are allowed to attend, you just need to register.  Hit up the link here and come on out for a full day (well, 8:30am - 5:00pm ET)!

- M

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories:   2010 | Development
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Custom Actions in SharePoint 2010: Knight Rider on Steroids? - Setting the Welcome Page via a Custom Action and Scripting via the Client Object Model

Monday, 11 October 2010 22:08 by Michael Mukalian

So, do you remember when Knight Rider "jumped the shark?"  When they had that season where instead of having a fast car, they added all sorts of flares and fins and enhancements to the stock car?  Yeah I know I'm dating myself, but bear with me here.  All those enhancements are like Custom Actions in SharePoint.

Say what?

OK...follow me here...SharePoint's the Trans Am, Custom Actions are all the fins and such on the car...but much cooler!!

Ok, that was kinda a stretch, but the concept's the same.  Custom Actions in SharePoint allow for customization of the UI with some additional enhancements.  Those enhancements can be tied to a List, a Content Type, File Type or ProgID.  These can be placed, well, pertty much all across the SharePoint UI.  They can go in the Ribbon, pretty much whereever the Ribbon is, menus like the Site Actions menu, as well as the drop-down menu for items (technically called the EditControlBlock).  They can be set up to go to a URL, fire off some javascript, or, call a class.

Now, rather than go through a long conversation on all the things you can do, I wanted to put out a specific example.  What we're going to do is key up a Custom Action that allows the individual to specify a new welcome page for non-publishing sites.  All folks know that in a publishing site you can set up what's considered the welcome (or opening) page, but for stuff like team sites and enterprise wikis that's not happening.  This example will walk you through the creation of a Custom Action that allows you to pick a different page (Basic or Web Part) and designate that as the welcome page.

Now, onwards!

Ok, let's set up the project.  Fire up Visual Studio 2010, create an Empty SharePoint project, and choose either Sandbox or Farm (this'll work in either).  After that click on the project, right-click and select Add --> New Item...then select the Empty Element item, and then click <Add>.  Now you should have all you need to get moving.

So, let's take a look at the following Custom Action.  Below is one that's specific to a content type: the Basic Page (0x010109) content type.

   1:  <?xml version="1.0" encoding="utf-8"?>
   2:  <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
   3:    <CustomAction
   4:      Id="ECBItemCustomization"
   5:      RegistrationType="ContentType"
   6:      RegistrationId="0x010109"
   7:      Location="EditControlBlock"
   8:      Sequence="106"
   9:      Title="Set as Welcome Page">
  10:      <UrlAction Url="javascript:
  11:                 var context = null;
  12:                 var listId = '{ListId}';
  13:                 var itemId = {ItemId};
  14:                 var web = null;
  15:                 var currentList = null;
  16:                 var currentItem = null;
  17:                 var rootFolder = null;
  18:                 var listTitle = null;
  19:                 var itemFileLeafRef = null;
  20:                 var newWelcomePage = null;
  21:                 
  22:                 getWebSiteData();
  23:                 
  24:                 function getWebSiteData()
  25:                 {
  26:                    context = new SP.ClientContext.get_current();
  27:                    web = context.get_web();
  28:                    currentList = web.get_lists().getById(listId);
  29:                    currentItem = currentList.getItemById(itemId);
  30:                    rootFolder = web.get_rootFolder();
  31:                    context.load(web);
  32:                    context.load(currentList, 'Title');
  33:                    context.load(currentItem, 'FileLeafRef');
  34:                    context.load(rootFolder);
  35:                    context.executeQueryAsync(setNewWelcomePage, failedCall1);
  36:                 }
  37:   
  38:                 function setNewWelcomePage()
  39:                 {
  40:                    listTitle = currentList.get_title();
  41:                    itemFileLeafRef = currentItem.get_item('FileLeafRef');
  42:                    newWelcomePage = listTitle + '/' + itemFileLeafRef;
  43:                    rootFolder.set_welcomePage(newWelcomePage);
  44:                    rootFolder.update();
  45:                    context.executeQueryAsync(displaySuccess, failedCall2);               
  46:                 }
  47:                 
  48:                 function failedCall1()
  49:                 {
  50:                    alert('error calliing from getWebSiteData');
  51:                 }
  52:   
  53:                 function displaySuccess()
  54:                 {
  55:                    alert('Site Welcome Page sucessfully updated to: ' + newWelcomePage);
  56:                 }
  57:                 function failedCall2()
  58:                 {
  59:                    alert('error calliing from setNewWelcomePage');
  60:                 }
  61:                 
  62:                 "/>
  63:    </CustomAction>
  64:  </Elements>

So, line 3 starts it all off with the CustomAction element.  This'll go inside an Elements node (we created this when we selected the Empty Element item above).  Lines 4-9 set up this action for what we want it to do.  Line 4 states the action's ID.  Lines 5 and 6 are key here as these are what tie it to a specific content type.  So, we set the RegistrationType to ContentType, and then set the RegistrationId to 0x010109 (a real quick tip, to find a content type's ID, add a new Content Type item type like you did above for the Empty Element one, pick the relevant type you want to base it on, and the ID will be commented out in the resultant XML for it).  Now that we set up it's type, we need to say where it's actually going to show up.  That's where line 7 comes in.  The Location attribute states where this will go, and for us to have it show up in the dropdown menu of the item we set this to EditControlBlock.  Line 8 sets up the ordering priority of the action via the Sequence attribute and line 9 is the text that's displayed in the area (via the Title attribute).

So, those lines above result in where this Custom Action will appear, and how it will look (see image below, of a document library whose content type is a Basic Page).

Now that we have the location and how it'll look, we need to give it something to do.  This is where the UrlAction element comes into play.  This element lets you point to a valid URL, or execute some javascript.  Now, here's the cool part, and brings us to the second point of our article here.  SharePoint 2010 now comes with the new Client Object Model and allows access to it through scripting, in this case the ECMAScript Class Library.  Why's this important?  Well, this will allow us access to this site's objects via the client scripting mechanism.  While you could also do this via an assembly, I wanted to show off what you could potentially do with the client OM.

So, line 10 sets up the UrlAction and the Url attribute to call some javascript.  Lines 11-20 initialize the variables to be used, but take note of lines 12 and 13.  See the items in the squiggly brackets?  These are called Url Tokens and give access to specific infromation behind them.  In this example {ListId} returns the GUID of the list that the action's working on, and {ItemId} returns the integer of the item within the list.  We'll use these to grab the relevant objects and information to continue our process.

Line 22 calls the function we're creating at line 24-36.  Within this function are the key lines that set up access to the necessary objects.  Line 26 starts it all off as that's how we get access to the current context we're in.  From this, we can get the actual website that we're in (line 27).  Once we've a web object, using the information from the previous tokens, we can get all sorts of stuff.  So we use this to get the list, item and rootFolder objects.  Now, we don't really have those objects yet, we have to load them into the current context.  This has to be done in order to retrieve those properties.  And after all that, we need to actually execute the pending client request to get all that information (line 35). 

Now that we got all that information, we can act on it.  The function called upon a successful execution from the previous call (line 35) will allow us to actually set our new welcome page up.  We get the title of the list, the physical filename of the item that we're on, concatenate it and then set the welcome page via the rootFolder object.  In order for the change to take we fire off the update() method of the rootFolder.  Now, just like before, we need to execute the request to actually do that work.  All this happens on lines 38-46.

Upon successful execution, you can now click the 'Home' link on your site, and see that it goes to the page that you executed this Custom Action on.  Pretty neat, eh?

So, what did we find out here?  Through the utilization of just some XML and javascript (ECMAScript), SharePoint 2010 allows you to do some pretty neat (and relevant) stuff, right?

Hopefully this example will help you out, and put you on the path to creating your own Custom Actions.  Enjoy! - M

Bonus Track!

Just cause I like to try and wire things up right, the below Custom Action creates an item in the Site Actions menu that reverts the site's welcome page back to the default one (in this case the SitePages/Home.aspx).  It is hard-coded, but this is just to show you the example of how it's done.  Enjoy! - M

   1:  <?xml version="1.0" encoding="utf-8"?>
   2:  <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
   3:    <CustomAction 
   4:      Id="SiteActionsToolbar"
   5:      GroupId="SiteActions"
   6:      Location="Microsoft.SharePoint.StandardMenu"
   7:      Sequence="1000"
   8:      Title="Set Welcome Page to Default">
   9:      <UrlAction Url="javascript:
  10:                 var context=null;
  11:                 var web = null;
  12:                 var rootFolder = null;
  13:                 var defaultWelcomePage = 'SitePages/Home.aspx';
  14:                 setDefaultWelcomePage();
  15:                 function setDefaultWelcomePage()
  16:                 {
  17:                    context = new SP.ClientContext.get_current();
  18:                    web = context.get_web();
  19:                    rootFolder = web.get_rootFolder();
  20:                    context.load(web);
  21:                    context.load(rootFolder);
  22:                    rootFolder.set_welcomePage(defaultWelcomePage);
  23:                    rootFolder.update();
  24:                    context.executeQueryAsync(successCall, failCall);
  25:                 }
  26:                 
  27:                 function successCall()
  28:                 {
  29:                    alert('Welcome Page set back to default');
  30:                 }
  31:                 
  32:                 function failCall()
  33:                 {
  34:                    alert('fail');
  35:                 }"/>
  36:    </CustomAction>
  37:  </Elements>

Currently rated 3.3 by 3 people

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

On The Road Again...SharePoint Saturday - Baltimore!

Friday, 6 August 2010 09:04 by Michael Mukalian

Hey folks, heading down south this time to the Inner Harbor in Baltimore for SharePoint Saturday - Baltimore!  Just got accepted to do my Features/Solutions talk, so come on out and soak up all that SharePoint goodness!  Saturday, August 28th, details here.

Note: This weekend is also the 11th annual Baltimore Comic-Con!  SharePoint and comics!  Sweet!!

- M

Be the first to rate this post

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

2010 Helpful Tip - SPListCollection.TryGetList Method

Friday, 2 July 2010 14:13 by Michael Mukalian

Remember when (days long ago...) you tried to instantiate to a list in SharePoint via either SPWeb.Lists["List Name"] or SPWeb.GetList("list URL"), you'd not know if the list was truly there until your code went along it's merry way, or it exceptioned out?  Well here comes SPListCollection.TryGetList().  Passing in the title of the list will either return the SPList itself or null.  At this point you can then do a null check and address it accordingly, instead of relying on an exception.

Something a little cool I just came across... - M

SPListCollection.TryGetList Method

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories:   2010 | Development
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Windows 7, Virtual PC and SharePoint Development

Monday, 17 August 2009 08:44 by Michael Mukalian

Took the plunge this past weekend and wiped my Dell XPS M1530 and installed Windows 7 Ultimate as well as Virtual PC.  After that, configured VPC to point to my external HD and voila!  SharePoint development environment.  No funky steps had to be done.  The same challenges are still there (32-bit guest OSes only), but all was working as of last night.

Screenshots after the break...

-M

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories:   Development
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

SharePoint Designer 2007 Now Free!

Tuesday, 7 April 2009 11:37 by Michael Mukalian

Just caught this today...check it out!

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=baa3ad86-bfc1-4bd4-9812-d9e710d44f42&goback=.hom

Be the first to rate this post

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

Impersonation Instead of RunWithElevatedPrivileges

Monday, 9 February 2009 13:50 by Michael Mukalian

In my Googling (we all Google to find stuff that we can use, instead of creating from scratch, right?) to find some help with an issue I was having when trying to loop through the UserProfileManager, I came across a really awesome post of Victor Vogelpel's blog that cites some code that Julien Lepine wrote to do some impersonation of the Web Application's ID.  What this code does is basically create an Identity class that runs in the context of the Web Application's ID.  Now, how does this differ with SPSecurity.RunWithElevatedPrivileges?  Well, RunWithElevatedPrivileges is kinda like a "black box" implementation in the context of the built-in "SharePoint\System" identity.  If you utilize the Identity class described above, and you give your Web Application ID the relevant access (in this case, the Manage User Profiles permission in the SSP), you're able to directly know who's doing what, where.  Better than just relying on a "black box" kinda implementation, no?

Check out the code from Victor's article.  It's a little old, but still very relevant.  Cool stuff.

Of special note: On the virtual I was working on at the time I couldn't get anything to work for the above example.  Turns out the issue was related to a fix that was applied when installing the December CU.  Remember to keep your virtual/development environments updated.

- M

Be the first to rate this post

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

How to Create a Cloneable SharePoint Development Environment

Friday, 2 January 2009 11:31 by Michael Mukalian

Well, I hope all had a great holiday, and welcome to the first serving of the Coffee House for 2009.

After having a number of SharePoint projects under my belt I decided to look into creating a cloneable development environment for myself.  The following is based on information and scripts from Ben Curry's blog entry on SharePoint Installation Scripts and Paul Horsfall's blog entry on SharePoint, Sysprep and SQL.  Both entries were invaluable in helping me create the process (and my scripts) below.

First off, below find the software used to accomplish this:

  1. Microsoft Virtual Server 2005 R2 (installed on your local machine)
  2. Microsoft Windows Server 2003 SP2
  3. Microsoft SQL Server 2005 SP2
  4. Microsoft SharePoint Server 2007
  5. Microsoft Visual Studio 2008

Now, let's create the necessary image:

  1. Create a new Virtual Machine, name it something sensical (in this case I called it MOSSDEV)
  2. During image creation, point to the Windows 2003 Server files and install the OS
  3. Name the machine the same as the image name (again, in this case, MOSSDEV)
  4. Upon completion give the machine the Application Server role, setting up IIS and ASP.NET
  5. Run Windows Update
  6. Install .NET Frameworks 2.x and 3.x
  7. Run Windows Update
  8. Create the necessary local machine IDs if you wish to run the various SharePoint services under them and not all under 'Administrator' (I do this out of habit instead of using the admin ID)
  9. Install SQL Server in its default installation (Install SP2 afterwards)
  10. Run Windows Update
  11. Install SharePoint Server 2007 but do not run the Configuration Wizard (Remember Advanced/Complete)
  12. Install Visual Studio 2008
  13. Install the SharePoint development assets (Extensions, WSS and Office SDKs)
  14. Run Windows Update 
  15. Install Sysprep for Win2K3 SP2
  16. Shut down the virtual machine, then copy/backup the VM's files (This is necessary as you can then spin this back up to do patches and the like, then back it up)


At this point you should now have a working MOSS machine/image that's ready for Sysprep.  Sysprep requires an .INF file to run and I've attached the one I use to create my images.  Note that you'll need to open it up and enter your correct Product Key for use.  Also note the ComputerName entry and how it's valued with an asterisk (*).  This tells the system to wait for user input before it can continue.  What this allows you to do is give the machine a name during creation.  Both of these attributes are in the [UserData] section of the Sysprep.inf file.

Sysprep also allows you to run scripts after the spinning up of the machine.  In this instance I run 2 scripts: one to set up the SQL Server correctly (startsql.bat) and one to configure MOSS (mossconfig.bat).

startsql.bat does two things: it renames the SQL Server instance from the original (MOSSDEV) to the name that you gave the machine during spin up, and then it gives the relevant DB related rights to the ID to be used for MOSS configuration (note I use a different ID for this than 'Administrator', see Step 8 above).  You'll need to change the ID in this file if you use a different one.

mossconfig.bat basically does what it says: it configures MOSS.  It creates the Farm database, sets up the necessary services, creates 3 Web Applications (SSP Web Admin, My Sites and a Portal), creates the Shared Services Provider and configures it with those Web Applications, and then creates a Site Collection on the Portal Web Application.

To Sysprep the machine:

  1. Start the image back up, logging on as Administrator
  2. Make sure your Sysprep.inf contains the correct and relevant information (Product Key, scripts to run, scripts in their correct location, etc)
  3. Run Sysprep (the system will shut down when complete)
  4. The resultant .VHD is now ready for use as a base image for creating differencing disks in Virtual Server.  Make sure you set the properties of the .VHD to Read Only before you use this.


This newly created .VHD is what will be used as the parent when creating new Differencing .VHDs.  The advantage here is that you can now create as many Differencing .VHDs as you want, all using the parent we created, and upon spinning it up you'll have a new MOSS environment to work in.  Note: when you spin up your development image for the first time, and it asks you for your machine name, it'll finish up its configuration of the machine, and then restart.  When it asks you to log on, you must log on with the ID you set up to be the MOSS setup ID (in my files I use the ID 'adminmoss' for this).  This is important as this ID will then be used to configure MOSS.

Now, when you want to create a new MOSS development environment, you create a new Differencing .VHD, use the above as the parent, and then create a new Virtual Machine using that new Differencing .VHD.  Quick and easy from that point on.

Attached in this post is a .ZIP file (CloneableAssets.zip) containing the 3 files above.

Thanks! - M

CloneableAssets.zip (2.29 kb)

Currently rated 4.0 by 4 people

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

Present(ed)ing at the Philly.NET Code Camp on October 11th!

Friday, 26 December 2008 16:26 by Michael Mukalian

As the munged title kinda states, this posting relates to an event that has already happened. So much fer real-time, eh?

I was able to present a more "code heavy" presentation of my talk on Features and Solutions at the
Philly.NET Code Camp on Saturday, October 11th. I gotta say, what a cool event. Hundreds of folks showed up, early on a Saturday, and stayed til the evening, listening to tracks from 51 speakers that ranged all across the .NET space. It was one of the coolest things I ever did, meeting with peers, speaking on topics we all are interested in.

I'm tidying up the source code that I used for my talk and will upload in the very near future.

Oh and to any and all that showed up for my talk...thanks! - M

*** UPDATE ***
As promised, here's the code and presentation slides...
CodeCamp20081011.zip (842.53 kb)

Be the first to rate this post

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