Tuesday, December 08, 2009

"There was an error retrieving data to display in this Web Part." with CQWP

I'm back with a new error... I knew it wouldn't be long.

This one is tricky because the error: "There was an error retrieving data to display in this Web Part" doesn't really tell me much of anything.  I also went into the 12 HIVE/LOGS and found little success in there as well.  We have things output as Verbose, and running Sharepoint on 3 domains makes it tough to find what you need.

So I went back to google and searched a bit more and finally came across: http://blogs.msdn.com/ecm/archive/2006/10/25/configuring-and-customizing-the-content-query-web-part.aspx

I went through the comments and found a clue to what might be the problem: "Most likely the error is caused because the lookup column allows multi choices.  Multi choices is not supported by the Cross List Query [XLQ] which is the data source of the Content Query Web Part" - Adri

Thanks Adri, I saw this on another page as well but I really didn't know where to look with an excess of 1000 sites being in existence.  I also noted, this error was hit or miss.  I would get it on certain page, or when I was filtering/grouping on certain criteria.  Most notably, filtering by 'Assigned to = Current User'.

Then another comment on that page (actually it was preceding): "I have just found that by grouping the items by another lookup column on that content type, the Portfolio lookup is displayed. As soon as I take this grouping off I get the error message as above. How strange." - Sam

That pretty much solved it for me.  Obviously, group on the filtered item that is causing the issue. And.... BOOM it worked.  Also to note, if you're displaying that field, 'assigned to' in my case, then you won't have an issue and won't have to group on it.  This can be a problem in some SQL code too, which makes sense because Sharepoint [lists] is an abstraction of SQL (more or less right?).

This error was fairly hard to solve because you don't have much info to work with.  I'm hoping someone else who happens to be blessed with this error can stumble across my blog!

One thing to note: My case is a more rare case.  The most typical cause of this error is that your XSL or outputted HTML is malformed and needs some debugging.  I knew that this had been working perfectly at one point, so there was something else going on. Definitely check the XSL first, though.

Wednesday, December 02, 2009

Branding and Sharepoint Permissions

Hello again!  I'm going to share with you a tricky little situation I got into today.  Maybe not a huge issue for a Sharepoint pro, but was very frightening for me. I'm going to preface this post with a little story to set the mood.  I'm not looking for a ton of sympathy but I just want to put the project I'm working on into perspective for my readers:

First off, I'm working in a LARGE corporate environment that is migrating all business practices to Sharepoint.  WOOHOO!  Easy right?  Well I guess that is why I have a job right now... no one else wants to do it, and we've had two people quit leading up to my hire (within months of eachother none the less).

This project is almost two years over due now, so no rush... we'll be careful this time and try not to fall into the same holes as we have in the last two years.  I've only been here a few months but I can see the wreckage and leftovers from various consultants and ex employees...

Did I mention we don't have a test environment?

Or that I'm the ONLY developer, .NET and/or Web?

So I'm working on Branding, which is how I spend most my days here.  That is, when I'm not being a Sharepoint admin, or publishing content, or running training seminars.  Not bad for a Junior C# developer.  And I'm branding still.  On 3 different MOSS web apps, with 3 different themes of branding.  Javascript running in masterpages doing god knows what?  Look at that!! I take it out and the page runs faster and smoother.  And I dont have any weird disappearing text.  Wonder why that was there in the first place?  I'll never know though, because the amount of original developers still on the project is ZILCH.

Ok enough rambling.  Here is the educational portion of my post.

Everything I've been working on is fairly stable, looks a little better than myself with a hangover, and runs a little smoother than the original implementation of webparts, css, html, etc...

I'm pretty happy and proud of my work thus far.  We're getting ready to permission about 2-3000 users when I get the bright idea to test these permissions with a view only permissioned account.  Brilliant! So I create the account in active directly, permission it up, and go to a landing page on one of our domains. EPIC FAIL.  My "Zone Tabs" web part is all F'd up.  My custom Content Query Web Parts are erroring out. Hmmm...  Wheres the nearest cliff in Manhattan?  Well I guess theres the A train.

I double check my permission 20 times.  Experiment readding webparts, pointing the CQWPs to lists directly.  Tweaking some other crap.

Then it hits me: Don't you have to Publish Master pages in the Master Page Gallery, then Approve them before regular users can see the changes?  Well yea.  So I double check that, and among the 3 domains I missed approving one.  Well turns out that isn't the problem anyway.  Turns out, my custom .XSL files for my CQWPs need to published as well.  As do a few CSS files I had laying around in my Styles Libraries.  GRRR

So after lots of frustration and near suicidal moments, I was able to remedy this.  (Note to readers:  I am not suicidal, but I am a binge eater, drinker, and sleeper.  So there may have been a bit of that.  I am fairly stable overall.)  Lastly, be sure to PUBLISH and then APPROVE everything in your base Galleries, ie MasterPage, CSS, XSL... It will save you a lot in the end!

Friday, November 20, 2009

Customizing MySite -- not for the faint of heart

I'm not going to get too in-depth here because, to be honest, there are some decent guides out there already (or at least one).  My problem was finding them, rummaging through all the BS only to find that the solution won't fit my scenario.  My scenario is/was enterprise based so I needed to have the ability to deploy to a farm.  Some other caveats of my situation:

  1. *Should* be supported.
  2. Already has a feature and stapler feature from a previous developer.(these are needed to hook into the MySite creation process).  Source code no where to be found.
  3. Custom webparts, custom master page, and custom CSS need to be deployed alongside.  Custom images and some compiled Silverlight also need to be deployed. I'm banking on fact that the .XAP file can just be copied over via the feature.  This is still waiting to be tested.
Now for the good part.  First your going to want to start with this blog post by Steve Peschka:
http://blogs.msdn.com/sharepoint/archive/2007/03/22/customizing-moss-2007-my-sites-within-the-enterprise.aspx



This outlines the procedure to do the customizations.  Its fairly complicated and being a reasonably smart person myself... I got lost along the way and was not able to complete it in one sitting.  This of course frustrates me, being the prideful person I am :)

So today I came across a Visual Studio solution to help accomplish this: http://www.codeplex.com/CKS/Release/ProjectReleases.aspx?ReleaseId=2824

The links from Steve's blog didn't seem to be working, so I was lucky to come across that link through another blog.  Thats a VS2005 solution but it converts nicely if you use 2008.  All in all, that is a great place to get started, and will help you visualize what Steve is talking about on his blog (and of course, because he made the project on Codeplex too).  If will also save you some time too, if you have deadlines and don't want to decipher everything from the ground up.

Thursday, November 05, 2009

Warning: The selected master page has no approved version. This site may appear to be broken to users without the view versions right in the Master Page Gallery.

This is a simple fix for a strange problem that I didn't expect.  I was going to apply a new masterpage to a site and some subsites when this lovely red message came up:

Warning: The selected master page has no approved version. This site may appear to be broken to users without the view versions right in the Master Page Gallery.

As that was something that I didn't want to risk I ended up deleting and readding the page to the masterpage gallery.  I also found these directions if you're looking for a fool proof method:


Click Site Actions –> Site Settings –> Modify All Site Settings
Click Master pages and page layouts
Click the down arrow next to your .master file
If Check In is an option, click Check In
Click OK
Click the down arrow next to your .master file again
Click Publish a Major Version
Click OK
Click the Down arrow next to your .master file
Click Approve/reject
Click the Radial Button next to Approved.
Click OK.


Check your page out again.
If that did not work, click the down arrow next to your .master file for the fourth time.
Click Manage Permissions
Make sure that Portal Members have Read rights.
If they do not, Click New –> Add Users


Type Portal Members in the Users Section
Click OK
Click Read in the Give Permission Section.
Click OK.

This should address both permission issues and approved version issues.

http://thenewpaperclip.com/2007/02/10/create-a-master-page-in-microsoft-office-sharepoint-designer-2007/

Wednesday, November 04, 2009

Workflow failing on start(retrying) - Sharepoint Custom Workflow Error

I had created a workflow for a client that just sends an email when an item is added to a Custom List. Depending on a field that was added, it would send to a different user.  Simple enough!  Started up Sharepoint Designer and created said workflow.  Added an item to the list and BAM:  "Workflow failing on start(retrying)". After recreating it several times and changing Token Strings within the XML, the problem still remained. So...

After battling with this issue for the past few days I finally found a solution.  First I went into my Sharepoint logs at: c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\LOGS\ . I ran a dos command  
"type [LogPath/MostRecentLogFileName] | findstr /i /r workflow >> c:\moss_errors.txt"

What this does is output any line in the error log which contains the string "workflow".  This lead me straight to the culprit: "Engine RunWorkflo
w: System.Security.SecurityException: Request failed. at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed) [...]"

So on an so forth...  Did a quick google search for that error and stumbled across a lovely post in this thread: http://social.msdn.microsoft.com/forums/en-US/sharepointworkflow/thread/20fd2a72-13e5-4310-a06b-3ded6e7d370e/?prof=required that stated that their Nintex Workflow 2007 program stopped behaving correctly after installing Citrix XenApp.  It did something to their "shared.dll" that allowed it to be uneditable... or so they thought.

On a whim, I decided to google "Citrix XenApp Web Interface for Microsoft Sharepoint" and I found this thread: http://connect.nintex.com/forums/thread/423.aspx which gave me the direct solution on how to fix things

Unfortunately it has recently come to our attention that the file shared.dll is being deployed erroneously to the following location:
C:\Inetpub\wwwroot\wss\VirtualDirectories\\bin


The work around is very simple, just delete the dll from this location and your workflows will function as intended. 


Perfect!  and there you have it.  Just drill down to said directly -- port was the domain name on my server, and move that file to a backup location or recycle bin and then try your workflow out. I recreated mine just to be sure.  Likely it should work if the error was due to the Citrix App.  Also make sure to make this change on all domains and servers if youre in a farm.

Tuesday, October 20, 2009

Using XSL to add a Link to a DataView Webpart populating from XML Web Services

A big problem was trying to display a list from another domain. Dataview Webpart saved me there and my next task was to make the title field link to the document. Since there is no document link readily available, youll have to create it yourself.

First youll need a xsl variable:


<xsl:variable name="webAddy" select="concat('[site]',
substring-before(substring-after(@ows_FileRef,'#'),'Tasks/'),
'Tasks/DispForm.aspx?ID=',@ows_ID)" /> 
 

Pretty simple and straight forward. If your field names don't match, change them accordingly. Next you'll include this:

<a href="{$webAddy}">xsl:value-of select="@ows_LinkTitle"
 /></a>



That just links up the field title to the file name. That's pretty much it. Since you can't use XSL functions within an HTML element, youll have to do both steps to get your link working correctly.