Social Icons

twitter google plus linkedin rss feed

Pages

18.8.11

Creating a Windows Forms application for SharePoint 2010

In my usual style, I think I have stumbled upon each and every possible problem before I could execute my application.

What with MOSS2007 it was bliss and cheerful laughter has become in SharePoint 2010 a task that took me at least an hour… And I was lucky because in my usual style again I am really late to 2010 and most of the problems have been solved and talked about in forums…

Well, I’ll write here my experience, so I wont forget the necessary steps next time hopefully.


I added the Microsoft.SharePoint.dll as usual to the references and started coding. I wrote my 3 lines application (I just wanted a tool to help me code) and hit F5.

“The type or namespace name 'SharePoint' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)”

Well, I was not missing anything, the problem was that you have to target the solution to the .Net Framework 3.5…

image

That was easy. There are a couple of places where you can find that. OK, F5 again.

“The Web application at http://localhost could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application”


- Oh come on! It’s there! Why can’t you find it? + Because you haven’t targeted me to 64 bits and I am not running natively. - Oops, sorry for that. + It’s OK, you just have to read my error codes, they really point you in the right direction.

image

This one was a bit trickier. But after changing that I happily clicked F5 again and… Surprise!

“The Web application at http://localhost could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application”


Yep, same error again… And I couldn’t find more info on the internet… What if it’s a permission problem?
image

Finally I started the Visual Studio as an administrator and it worked. Finally!

No comments:

Post a Comment

5.8.11

Hiding the Scrollbars in the SharePoint 2010 Web Parts

After deploying the first alpha version of our solution in SharePoint 2010 I realized that my Silverlight web parts were showing ugly scrollbars. I noticed that if I change the height and width to auto they will disappear… but then my web part will not have the right size…
I read this post: http://blog.benfox.info/?p=11 and, as you could have guessed, I went for the inelegant approach.
Then I found that the javascript code was in a picture… how inconvenient… and then I thought “I’ll show everyone that I can be as dull in SharePoint 2010 as I have always been in SharePoint 2007” Why not creating a post about that?
<script type="text/javascript">

 function HideScrollBars()
 {
 document.getElementById('WebPartWPQ2').style.overflowX = "hidden";
 document.getElementById('WebPartWPQ2').style.overflowY = "hidden";

 document.getElementById('WebPartWPQ3').style.overflowX = "hidden";
 document.getElementById('WebPartWPQ3').style.overflowY = "hidden";
 }

_spBodyOnLoadFunctionNames.push("HideScrollBars")</script>
And after struggling with the new Content Editor Web Part for at least 15 minutes I finally managed to hide the vertical and the horizontal scrollbars in my web parts.
Now I can proudly send a picture of the site in the SharePoint 2010 view.

--- Update --- I have changed the web part code so we don't need to use this crappy javascript code.

No comments:

Post a Comment