Feeds:
Posts
Comments

Posts Tagged ‘SharePoint 2010’

Sometimes it is a lot handier to just update one of the dll’s in the GAC rather than go through the pain of deploying an entire SharePoint solution. In fact it’s one of the key features that makes the CKSDEV Visual Studio plugin so valuable. Not best practice, to copy directly to the GAC, but very handy in a dev environment.

.NET 4.0 has a new gac location

Today, I wanted to quickly update a dll from a custom SharePoint solution. I was baffled when I could not find the dll in the assembly ( “c:\windows\assembly ” ) folder.

Turns out that starting from .NET 4.0 and up there is a new ‘GAC’ folder in town. It is now located in “c:\windows\microsoft.net\assembly“. You can simply browse to that directory with Windows Explorer and view all the folders.  The new GAC folder does not hide version information (=folders) anymore like the old one did.

assembly

They introduced this new folder to avoid issues between CLR 2.0 and CLR 4.0 , the GAC is now split into private GAC’s for each runtime.  The main change is that CLR v2.0 applications now cannot see CLR v4.0 assemblies in the GAC.

So keep in mind there are two folder now. One for .NET versions 2.0, 3.0, 3.5 and one for .NET versions 4.0 and up.

For more information on installing dlls in GAC
http://msdn.microsoft.com/en-us/library/dkkx7f79.aspx

More information about the GAC
http://msdn.microsoft.com/en-us/magazine/dd727509.aspx

Read Full Post »

Introduction.

In SharePoint 2010 you can use Google Maps without having to download extra webparts or third party tools. In this article I will explain how you can insert “Google Maps” maps in your SharePoint 2011 site with only using standard out of the box SharePoint 2010 features.

It’s a generic solution which can also be used to store HTML code that defines Flash and Silverlight HTML ‘assets’.

1. Get your Google map code.

  • Go to Google maps
  • Find the location you want.
  • In the right hand corner of the map click on “Link”
  • Next click on “Customize and preview embedded map”.
  • Enter the desired options.
  • Copy the HTML code that Google generates for you.
  • Paste the HTML code in a text file (use notepad).
  • Save the text file to your hard drive.

So you have the Google Map HTML code sitting in a text file now. Next step is to upload this file in SharePoint

2. Store the HTML code in SharePoint.

  • Go to your SharePoint site.
  • Click on ‘Site Actions’ =>’More Options’.
  • Click create and create a new Document Library “
  • When the library is created. Click on “Add document”.
  • And upload the Google Map text file you created in the previous step

Your Google Maps HTML code is in SharePoint now.  Next step: display it.

Note 1: An asset might be a more appropiate naming.  So an “Asset Library” might be a better choice. For simplicity sake we stick with a standard “Document Library”
Note 2: Feel free to add your custom content types to the library and fill out out the required meta data.

3. Display the Google Map.

Get the document url :

  • Go the library from the previous step.
  • Click on the Google Maps document you want to display.
  • SharePoint opens this file as plain text in your browser.
  • Copy the url of this file from your browsers address bar.

Add the Google Map to a page :

  • Open the a SharePoint page.
  • Edit the page.
  • Add the Content Editor web part
  • Clicking on “Edit Web part” in the web part context menu
  • Insert the document url, of the Google Maps text document, in the “Content Link” box.
  • Click on OK
  • Save the page.
  • If needed check-in and approve the page.

That’s it. Your Google Map is now visible on the SharePoint site.

The nice thing is that you can reuse this map in your SharePoint site. And when the map changes (change of address, etc…) you only need to change the text file in your Document Library.

Regards,
W0ut

Read Full Post »

The new Ribbon functionality in SharePoint 2010 can cause some frustration when creating custom master pages. The trick is to develop a master page with the ribbon always on top of your page without losing functionality and keep the content scrolling working correctly. Sometimes the scroll bars seems to grow outside the browser window leaving the end-user unable to scroll to the bottom of the page. Chances are that you forgot some HTML in the master page.

How does it work?

SharePoint 2010 fixes the Ribbon to the top of the page using CSS.  In order to display the scroll bars correctly a JavaScript runs to update the height of certain HTML elements. It does this by dynamically adding the style attribute to the targeted HTML tag. So in order the have a fixed ribbon with correct scrolling content you need:

  • JavaScript to calculate content height
  • A <div> element containing the ribbon
  • A <div> element containing the actual SharePoint content
  • Some CSS to hide / display the correct scroll bars

Luckily most of this functionality is already build-in in SharePoint 2010. You need to make sure that when creating a custom master page you include the correct HTML elements and JavaScript pieces. Here is how.

Adjust the master page.

For this tutorial I assume you are confident with HTML, you know what a master page is and how to edit a CSS file in a SharePoint environment.

Open your master page and look for the body tag. Add the attributes scroll=”no” and class=”v4master” to the body tag. So you get the following.

<body scroll=”noonload=”...” class=”v4master>

Leave the onload attribute as is.

Next make sure that in your HTML you have a <div> element to contain the ribbon. Do this by adding the following HTML element to your master page.

<div id=”s4-ribbonrowclass=”s4-pr s4-ribbonrowhidetitle>

If SharePoint finds this <div> element it will inject the Ribbon at this place.
Immediately after the closing tag of the above <div> ,  add the following div elements.

<div id=”s4-workspace>
   <div id=”s4-bodyContainer> 

      <!-- Your content goes here -->

   </div>
</div>

The s4-bodyContainer will be your main working pane. Add all your layout code, navigation, webpartzones, SharePoint controls, etc… go in this div element.
Finally you need to add the JavaScript that will dynamically calculate the height of the s4-workspace. Do this by adding the following JavaScipt code in the <HEAD> of your master page

<script type=”text/javascript>
var _fV4UI = true;
</script>

To be correct: this is not actually a script. You just declare a variable. The _fV4UI indicates  to SharePoint that the page is a version 4 type master page ( version 4 =  SharePoint 2010 master pages).

The CSS.

All the necessary elements for your fixed ribbon, scrolling content SharePoint page are now in place.  Add these CSS styles to display or hide the scroll bars on the correct <div> elements.

body #s4-ribbonrow {
     background-color: lime;
     overflow-y: hidden;
     min-height: 43px;
}

body s4-workspace {
   overflow-y: scroll;
   overflow-x: hidden;
}
body #s4-bodyContainer {
   width: 760px;
}

I added a fancy green color to the ribbon to make the changes more visible. Play a little with the CSS until you are satisfied with the result.

Happy branding..

Read Full Post »

We have discussed the SharePoint 2007 SPDispose tool here before. A new version is now available with SharePoint 2010 support and a Visual Studio add-in.

In addition to dispose guidelines they have also added rules on when not to Dispose. For example you do not want to dispose your SPWeb en SPSite objects in your SPContext.

More information can be found on http://blogs.msdn.com/b/rogerla/ and on the SPDispose codeplex page.

Download is available on here on the Microsoft download site.

Read Full Post »

Ran into a curious issue where I was only able to activate my feature only once after deployment. When I deactivate the feature and then try to activate the feature again, I received the following error :

 Error: A file specified in the modules section of this template already exists.

Resulting in this screen.

Luckily I found the file that was causing the error in the SharePoint logs.

Instantiating module “Style Library”: File already exists at URL “Custom.xsl”, module provisioning failed. 4938b7dd-7642-46aa-9020-a68534c2a726
A file specified in the modules section of this template already exists. 4938b7dd-7642-46aa-9020-a68534c2a726
The element of type ‘Module’ for feature ‘MyCustomFeature’ (id: e2fe1270-6a7e-4461-9542-d8b98a5361c2) threw an exception during activation: A file specified in the modules section of this template already exists.
Feature Activation: Threw an exception, attempting to roll back. Feature ‘MyCustomFeature’ (ID: ‘e2fe1270-6a7e-4461-9542-d8b98a5361c2′). Exception: Microsoft.SharePoint.SPException: A file specified in the modules section of this template already exists

Looking in the elements.xml of my feature I noticed that the attribute “IgnoreIfAlreadyExists” for this file was set to false.

<File Path="Style Library\Custom.xsl" Type="GhostableInLibrary"  IgnoreIfAlreadyExists="false" />

The MSDN documentation about this attribute states: “To provision even if the file aready exists at the specified URL”. Sounds like my error.

So I changed the attribute “IgnoreIfAlreadyExists” to true and…. no more error. Yeah!

<File Path="Style Library\Custom.xsl" Type="GhostableInLibrary"  IgnoreIfAlreadyExists="true" />

Hope it helps…

Read Full Post »

Microsoft has released some official information about SharePoint 2010.

Read more about it on their official site:
http://sharepoint.microsoft.com/2010/Sneak_Peek/Pages/default.aspx
(silverlight required)

Read Full Post »

Follow

Get every new post delivered to your Inbox.