Careful when you import that design manager package

8 May

Looking through some issues we were seeing with roll up images not appearing after you check-in and publish a page, and some ULS log message about a column not being defined, it appears that the process of exporting and importing a Design Manger package will corrupt some out of the content types, specifically for pages.

http://social.technet.microsoft.com/Forums/en-US/sharepointcustomization/thread/73c5fb6b-c346-4b7e-bef2-74865d05d1c5

So there is your hot tip for the day.

This is only like one of 4 things for today :/

Advertisements

Want to remove “recent” links from the Left Nav in SharePoint 2013? Good luck with that

2 May

I am working with a new SP2013 install and was noticing the new “recent” link that kept showing up on the left. I had gone through the navigation and deleted it manually,

But it kept showing up.

The implementation is for a pretty tightly managed intranet, so that was not going to work. I was assuming there was a place I could just turn it off. I wasn’t worried about that, but I thought I would do a quick search for how to fix that.

turns out, it is not as straight forward as I would expect. I found this note for this new feature.

http://www.jasperoosterveld.com/2013/02/sharepoint-2013-remove-recent-in-quick.html

The Recent-section gets added automatically through a WebControl on the page. To automatically remove the who section (including child navigation nodes of Recent) you could enable a custom feature, that simply does a .Delete() against the corresponding navigation node in SPWeb.Navigation.QuickLaunch navigation collection. Then just call your custom feature from your provisioning logic, and way Recent -section would always be removed upon provisioning a new site. Alternatively you could use some CSS-styling but that wouldn’t really remove it, but just hide.

Domain with suffix fails in AutoSpInstall

14 Dec
  1. First if you have not used AutoSPInstaller it is greatness. super handy for setting up multiple servers, multiple zones with SharePoint 2010 and now 2013. There are a lot of things you can forget, and this tool makes it all config file driven. good stuff.
So the situation is I was working through the 2013 support and getting a solid baseline cloud environment setup in cloudshare.
I had provisioned a few different VMs to match the recommended architecture for SP2013.
  • I had a SQL server..
  • and 2012 standard server,
  • and a 2012 Domain controller.
The domain that was provisioned was something like AD2012.loc. I went through the steps of adding the other two boxes to the domain. Letting cloudshare know I did it, and changed the default logins.
All so far so good. I downloaded the SP2013 bits, and the AutoSPInstaller and the new configuration GUI tool. Looks like we are ready to go.
SP2013 has a few reboots it may need to do in order for the process to finish, and for that to be automated you have an option to automatically login as admin. Which I selected..
However. the first part of the script say it is looking to verify that administrator account and I get this error:
Checking credentials: “AD2012\Administrator”…Invalid – please try again.

now you will notice that the domain is not correct.it is missing the little .loc at the end.
So I thought.. maybe there is a bug in the script.. so I looked through the script to see where this was happening..and it was simply pulling in an $env variable. UserDomain.
that should be correct.. but it wasn’t. see the powershell output below..
PS C:\users\Administrator.AD2012\Desktop\AutoInstall\AutoSPInstaller> $env:UserDomain
AD2012

PS C:\users\Administrator.AD2012\Desktop\AutoInstall\AutoSPInstaller> $env:UserName
Administrator

Ok, maybe there is another way to go about this:

PS C:\users\Administrator.AD2012\Desktop\AutoInstall\AutoSPInstaller>[Security.Principal.WindowsIdentity]::GetCurrent().Name

AD2012\Administrator

Same issue.
then I came across this article.. which seemed to cover that same issue.
  1. So I gave this a go:

    PS C:\users\Administrator.AD2012\Desktop\AutoInstall\AutoSPInstaller>  [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().Name

    AD2012.Loc


    Bingo, exactly what I was looking for. Now to modify the script and see if we can’t get a totally happy unattended install going.

CAML Query cannot complete this action

11 Oct
  1. I was working on a SharePoint timer job, similar to many I have done before. The small difference was that the client I was working with had a complex list of states that an item might be in. So I had to specify multiple strings to look for in the underlying CAML query.
    So I took what would have been something like:<And><Eq><FieldRef Name=’Type’ /><Value Type=’Text’>ProcessItem</Value></Eq>
    <Eq><FieldRef Name=’Status’ /><Value Type=’Text’>Pending</Value></Eq>
    </And>
    and changed it to <Or><Eq><FieldRef Name=’Status’ /><Value Type=’Text’>Pending</Value></Eq>
    <Eq><FieldRef Name=’Status’ /><Value Type=’Text’>Processing</Value></Eq>
    <Eq><FieldRef Name=’Status’ /><Value Type=’Text’>Queued</Value></Eq>
    <Eq><FieldRef Name=’Status’ /><Value Type=’Text’>Transferring</Value></Eq>
    </Or>

    Which promptly failed.
    and the error was “Cannot complete this action”
    I figured I had tried to grab too many records and the query was timing out, so I tried a few things before consulting the web.
    Fortunately the fix was simple to do, well documented and easy to find.

  2. Yep that’s it. CAML cant deal with more than two criteria inside of an OR or AND clause.
    SMH
    so now my code looks like this:<Or><Or><Eq><FieldRef Name=’Status’ /><Value Type=’Text’>Pending</Value></Eq>
    <Eq><FieldRef Name=’Status’ /><Value Type=’Text’>Processing</Value></Eq>
    </Or><Or><Eq><FieldRef Name=’Status’ /><Value Type=’Text’>Queued</Value></Eq>
    <Eq><FieldRef Name=’Status’ /><Value Type=’Text’>Transferring</Value></Eq>
    </Or></Or>
    Lame, but there you have it.

Jpgs in Sharepoint 2010 dont show in final page for IE8 and lower

11 Sep
  1. Ok, so here is the situation, I have a site owner. They have full permissions on the site, and can see all the other images in the same library. In fact they can see other JPGs in the same library. When you go to the library they can see the images in the link, when they mouse over they see the pop up with the image. BUT when they go to a page that has the image in it they see a red X. And if they open the image directly, red X. But it is limited in our data to only one JPG. What gives?
  2. We ran the normal permissions checks, ran a fiddler trace, tried it from different users, and machines. And it appeared to be machine, not user specific. since the user could see the image on other machines. And it was not machine specific since other browsers on this persons machine could resolve the image. It wasn’t a caching issue since we cleared that out.
    Turns out it was IE8 specific. And here is what it appears to have been.
  3. IE 8 could not render the JPG since apparently the graphic artist saved it as CMYK and not RGB. And since the newer versions of IE and therefore the newer versions of SharePoint graphics routines could handle it, it was able to generate the thumbnails that the user was seeing in the administrative interfaces. So the user could see it in the library list, mouse over and see the correct image, assign it to a page, see it in other browsers, and on other machines (which had IE9) and just not on the final page in IE8 (or 6 or 7).
  4. Solution was straight forward, open it up in Microsoft Expression Design 4, and save the image as a PNG or JPG with RGB color palettes.
    Problem solved.

SharePoint 2010 Taxonomy store and Ampersand issue

10 Sep
  1. I ran into a weird issue while I was working with the SharePoint taxonomy term store to upload some managed metadata. I had modified the code to check for existing terms, and if they were not there to insert them. turns out there were no errors when I had tested it, but when I ran it against the production file I would get errors, that I was trying to insert a duplicate key.
    I did some tracing, and for some reason Ampersands in the term name were causing failures. further investigation showed that even though the term was in the comparison list, the compare criteria was failing.
    After a little more time, and some unsuccessful approaches, I notices that the ampersand in the watch window looked a little different from the comparison string vs the input string.
  2. && << look similar don’t they?
    SharePoint doesn’t think so
  3. So I thought it was a different font, or bolded, or something. I tried pasting into excel and getting the unicode for the mystery character, and it did indeed come back as not an ampersand.. but what was it.. A little more searching and I cam e across this:
  4. that was the smoking gun. The system was transforming the input text as I was putting it in. so when I pulled it back out to compare to the new list, it was just subtly different enough to fail the comparison, and then once I tried to insert the text, it would transform it on the way in and throw an ugly error about key violations.
    Solution in my case was straight forward, I did not need to transform the text back into it original form. I just needed to know if what I was looking at was already in there. So I Used the TaxonomyItem.NormalizeName method to pre transform my input text and then compared that to what was already in the terms collection.
    worked out much better.

Creating a Copy of a Custom Sitemap in SharePoint 2010

10 Sep
  1. I wanted it cached and I was planning to use the HTTPruntime to handle the caching in my code. The issue I ran into was that since the root object was a complex reference type with deep nested elements, the changes and trimmings I made to the data ended up propagating all the way back into the HTTP Run time cached object. I came across this link which seemed to cover the issue.
  2. However that method required that and iclonable interface be implemented. So that did not work since the object was just a bare data class/structure.
  3. This method looked promising, but also did not work. So I accepted that I was going to have to create my own copy logic and attach it to the base object as a method. So I did some searching and found this very helpful article.
  4. the only change I needed to make was swapping out one argument type here.
  5. the original article called for a fieldinfo array to be grabbed from the type, but the way I had it set up, I needed to grab the propertyInfo array from getproperties. And since this was a List<string> type in my example, I then had to iterate over it to copy the object.

    Once I made these changes, I was able to new up a copy of the original object, avoid all the calls back to the taxonomy store, and make whatever trims and modifications I wanted without corrupting the base object.
    pretty handy, and not to hard to pull off.