Monday, October 11, 2010

Strong Name Key–“Access Denied” Error on Windows 7 64-Bit in Visual Studio 2010

I got bit my this again today, so thought I’d re-post:

http://thethoughtfulcoder.com/2010/03/16/Strong-Name-Access-Denied-Error-On-Windows-7-64bit-From-Visual-Studio-And-Snexe

I was trying to create a strong name for an assembly in Visual Studio from the project properties using the dialog:

Create Strong Name Key Dialog

After clicking OK I received the following error message: The operation could not be completed. Access is denied.

Strong Name Access Denied Message Box

I then tried from the command prompt using sn.exe and received the same type of message: Failed to generate a strong name key pair -- Access is denied.

sn-AccessDeniedCommandPromptMessage

I found the following blog post Create Strong Name Key - Access Denied Error, but it applies to Windows XP. I searched around for a RSA\MachineKeys folder and found three different locations but it seems the folder C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys is the magic place.

I gave my user the following permissions on the MachineKeys folder and then I was able to sign my assembly :-D

Modify Permissions

Sunday, October 3, 2010

How to Hide the “Ribbon” in SharePoint 2010


I struggled with this quite a bit before finding a solution that – as near as I can tell – simply hides the ribbon without any real consequences.  Of course, no ribbon means that when in a list or library you can’t do a whole lot.  In my case this requirement was handed down because the particular page we’re doing this in will only contain static content, and the customer wanted to save the screen real estate to make SharePoint look “more like our old version.” 

A frustrating request of course, but nonetheless I imagine many of us in the SharePoint world will come across this request at some point or another. 

After a few other attempts (such as simply deleting the controls in SharePoint Designer, or using different CSS methods and <asp:Panel> controls to set visibility and display properties, I kept getting JavaScript errors on the page, loss of the vertical scroll bar, and other odd behavior.

Here’s the solution I ended up with.  We didn’t want to do this at a site-level, so to do it at a page level we simply modified the appropriate <DIV> tags inline in the ASPX page (using SharePoint Designer):

<div id="s4-ribbonrow" class="s4-pr s4-ribbonrowhidetitle" style="display:none">

<div id="s4-ribboncont">


noribbon

Saturday, September 25, 2010

Intro–InfoPath 2010 Form Design with C# Code-Behind (Part 1 of 2)


Last week I had to create my first InfoPath 2010 form with code-behind for some custom business logic (as the business requirements were explained to me it quickly became apparent that “Rules” available in InfoPath weren’t going to be sufficient).

InfoPath is admittedly not a strong suit for me.  The small amount of interaction I had with it in IP 2007 and MOSS 2007 left me with a feeling that it wasn’t quite ready for prime-time, so I largely ignored it.

I have a new respect though for the most recent incarnation.  InfoPath 2010 is an incredibly powerful tool as I’ve learned.  Here’s Part 1 of a brief 2-part blog post describing how I went about implementing some custom business logic – including data access to a SQL 2008 R2 database – with custom C# code behind an InfoPath 2010 form, rendered as a browser form in SharePoint 2010.

Wednesday, September 8, 2010

“MySites” in SharePoint 2010


This post simply references a video I recorded for a customer a few months ago.  In it I give a brief overview of some of the new features of “MySites” in SharePoint 2010, and perhaps more importantly, some of the business reasons why these social features actually provide value in the enterprise. 

Many clients I’ve worked with in these early days of deploying SharePoint have chosen to disable the social features of SharePoint 2010.  While I understand the initial impression (“I don’t want Facebook inside my company!”), there is real business value to be gained by many of these features. 

This screencast was recorded as a reference point so my client could revisit some of these business reasons later down the road when they made a final decision about whether or not social features will be enabled for their organization. 

(P.S., I’m also testing Google Alerts to see how quickly this gets picked up!)

Here’s the screencast (thank you Camtasia!):

http://www.screencast.com/users/JonSchultz/folders/Default/media/58e6fb89-f1fd-41a2-990d-a1f022fb3541

FirstFrame


 

Jonathon Schultz
mobile:
407.923.4946 | fax: 866.569.2615 | email: jon@jonschultz.com

Tuesday, September 7, 2010

Team Foundation Server 2010–Work Item Basics

 

Here’s how to create a new bug in TFS, create custom queries, and track them in the SharePoint Foundation Site created for my sample TFS Project.  


Creating and Assigning a Bug (or other type of Work Item)

So most of the time you’ll create and assign bugs from within Visual Studio (within the Team Explorer plug-in for VS2010 to be precise).  So if you expand the tree view of the Team Project you’re working with and right-click “Work Items”, you can choose “New Work Item” > “Bug”:

 

Fill in the details, and assign it to someone (in this case I assigned it to my colleague Kagan):

Now we’re done creating and assigning the bug. 

 

Querying Work Items

If you expand “Work Items” then “Team Queries”, there’s already a bunch of queries to display “My Bugs”, “My Tasks”, etc.  You can also create your own:

In this sample I created a custom query that shows me any type of work item, for any project, assigned to Kagan.  When I click “Run” you can see I get one result:

When I change “Assigned To” to the parameterized “@Me” keyword, I get zero results:

Hit the “Save Query” button and I can save this under “My Queries” (so only I can see the query), or under “Team Queries” so anyone can use it:

Project Dashboard

If I go to the project dashboard site (right-click the Team Project in Team Explorer and choose “Show Project Portal”), it takes me here (http://hqsrv107/sites/DefaultCollection/UTPurchaseOrders/Dashboards/ProjectDashboard_wss.aspx):

On the right side of the screen I can click where it says “1 Bug” and it takes me to a list of all active bugs:

Double-click the bug and we get a window where we can see details of the work item, and make changes if we want.  I’ll change the “Assigned To” field to me and leave a comment.  Then click “Save and Close”:

Now, when I click “My Dashboard” on the left-hand side of SharePoint, the “My Bugs” web part now shows that I have one bug that’s currently active and assigned to me:


 

Jonathon Schultz
mobile:
407.923.4946 | fax: 866.569.2615 | email: jon@jonschultz.com

Tuesday, September 8, 2009

Master “Roll-Up” Calendar in SharePoint 2007


This post simply references a video I recorded for a customer.  I was asked to build and demonstrate one approach to consolidating six calendars that were maintained independently across the organization into SharePoint 2007.  Some were updated simply by making changes to static HTML pages, while others were served up by a variety of application servers (classic ASP, Rails, PHP, etc.).

The premise of my solution was that all these individual calendars needed to be migrated to SharePoint, since that was a large organizational objective anyway.  Once that was done, a “master calendar” would be created in SharePoint, and a custom event handler would be written in C# so that create, update, and delete events in any of the six “child” calendars would be synchronized to the “master” calendar. 

http://www.screencast.com/users/JonSchultz/folders/Default/media/2663912c-23d0-4eb3-871e-91889baf0681

UT

Caveat:  I realize that most of these stated requirements could have been achieved with some combination of either custom views or perhaps content types.  However, I was also instructed that our solution needed to connect to Outlook, Entourage, and essentially any other RSS reader our customer might choose to use.  The organization has a large percentage of Mac users, and after testing a few approaches using views and content types, we found a simple custom event receiver to be more reliable when serving the content across such a wide variety of consumer applications. 


Jonathon Schultz
mobile:
407.923.4946 | fax: 866.569.2615 | email: jon@jonschultz.com

Wednesday, November 12, 2008

SharePoint Performance Analysis Tool

This is a re-post from the Microsoft SharePoint Team Blog.  They’re releasing a tool in the next couple of weeks that allows you to do a very quick analysis of your SharePoint code’s performance. It focuses around disposing of SharePoint objects properly in your code, and “using (SPWeb web) …” coding techniques to ensure objects are released from memory when a code block exits. 

As soon as it drops I’ll make sure I post about it again and provide a download link.  In the meantime, this blog post directs us to a few best practices articles about how to properly manage memory for high-performance SharePoint code: 

 

The SPSite and SPWeb Dispose() methods are an important thing for developers who work with Microsoft SharePoint Products and Technologies to master. Many SharePoint API's allocate COM based memory that is not released by CLR garbage collection and must be released by calling the Dispose() methods. Microsoft Guidance for when to call SPSite and SPWeb Dispose() methods have been published in this MSDN whitepaper by Mike Ammerlaan and Scott Harris. In addition, Roger Lamb has provided additional detail and discussion on his MSDN SharePoint Developer blog. This guidance applies only to customers building custom software that they compiled to .NET assemblies that make use of SharePoint API calls.  Also, an update to the MSDN whitepaper is being planned to reflect key guidance from the blogs.

Microsoft wants to help developers build better quality code that manages available memory better. We are now building a console tool that will help to evaluate customer code against the guidance that is provided. The tool, calledSPDisposeCheck, will open your custom compiled assemblies recursively and validate them against the Microsoft published guidance. The output from the tool will contain messages that may indicate the SPSite and SPWeb Dispose() methods guidance is are not being followed in the customers source code. While these messages need expert evaluation in order to determine if the software is not performing properly, in some cases just running the tool on your custom code can lead you to simple fixes that improve the quality and performance of custom code on SharePoint. This tool is planned for release during the coming North American Winter.  Customers who are currently experiencing difficulties with memory management in their custom applications should review the guidance listed above.  Customers who are currently experiencing difficulties with Microsoft Office SharePoint Server 2007 should contact their regular Microsoft Customer Support Services contact, or refer to http://support.microsoft.com.

References:

Best Practices: Using Disposable Windows SharePoint Services Objects

Best Practices: Common Coding Issues When Using the SharePoint Object Model