SharePoint 2013 Notes I

Well here’s another post of nifty things to remember. I’m working with SharePoint 2013 (YUCK!) and I ran into a few idiotic idiosyncrasies about it. Here’s a quick post.

Classic SharePoint Breadcrumbs

SharePoint breadcrumbs are hidden in 2013. They’re not included in the default master page… WTF? And when you enable them in your master page (if you can even figure out how to modify the master page), they’re really stupid. They’re a drop down.

First let’s talk about the master page for a sentence or two… The new master pages are only modifiable via their HTML counterpart. So make a copy of the default seattle.html “master page” and that will create another one for you. Rename it as you like and it’s .master will be renamed too. Really stupid, huh?

So you’re just supposed to remove the display: none on the .ms-breadcrumb-dropdownBox div and that brings back the “breadcrumb” but it’s not your typical breadcrumb. It’s a dropdown breadcrumb which sucks ass.

Want a normal breadcrumb? Here’s the code…

<div class="less_crappy_sharepoint_breadcrumb">
<!--SPM:<asp:sitemappath 
    runat="server" 
    sitemapprovider="SPContentMapProvider" 
    rendercurrentnodeaslink="true" 
    nodestyle-cssclass="breadcrumbNode" 
    currentnodestyle-cssclass="breadcrumbCurrentNode" 
    rootnodestyle-cssclass="breadcrumbRootNode" 
    SkipLinkText=""/>--> 
</div>

Add this right below the .ms-breadcrumb-top div is what I did. I also removed the crappy suck ass breadcrumb since it’s useless to display it then hide it with CSS. Useless!

Styles In The Masterpage

Apparently since everything is done with this .html file, any ASP code or any other code in style tags (probably script as well) has to be “commented out.” Use the following if you want to put styles in your master page.

<!--MS:<style type="text/css">-->
.ms-core-listMenu-horizontalBox li.static > a {
    display: none !important;
}
<!--ME:</style>-->

Lame, huh?

Oh, and watch out. For some reason SharePoint 2013 don’t do the > anymore so you’re probably going to have to put things like that in the style sheet… (always a good idea anyway).

Hiding The First Top Menu Item

How stupid is this? By default your site name is next to the logo… like you need it twice or something. Want it gone? Tough cookies. You’ll have to hide it with CSS.

Here’s your CSS:

.ms-core-listMenu-horizontalBox li.static > a {
    display: none !important;
}
.ms-core-listMenu-horizontalBox li.static > ul a {
    display: block !important;
}

Stupid! I hate SharePoint and I hate SharePoint 2013! How can anyone think this CMS is good. It’s a heavy footprint and look at all the work you have to do for basic things!

I might update this post with more stuff you shouldn’t have to do to get SharePoint to look and function the way websites should OOTB.

#SharePointGetALife #SharePointYouSuck #SharePointWTF

UPDATE: Get Default/Welcome Page Of A SharePoint 2010 Site

PROBLEM
I needed to find the default or “welcome page” of a SharePoint site. I needed this because I need to pass in a query string parameter to it. For example, if I passed in the string “http://www.mysite.com/staff”, it would give me “Pages/index.aspx”.

After surfing the net, the threads I read on Microsoft and other sites were not helpful at all. Most lead me to complex lines of code that used different utilities that I wasn’t familiar with. (I’m not that familiar with this stuff as it is.)

SOLUTION
I finally decided to ask the question on stackoverflow. My question was How do I get the default/welcome page of a SharePoint 2010 site?.

In a few minutes, a dude answered with a link to a thread on Microsoft. It was pretty helpful although it wasn’t complete as it gave me a few errors:

  • First it gave me an unrecognizable PublishingWeb. To solve that, I had to add the Microsoft.SharePoint.Publishing reference to the web part.
  • Second it gave me a cannot convert type SPFile to string. Trying .toString() didn’t work. Turns out SPFile has a Url function which returns a string.

The finished function is:

private string GetSPSiteUrl(string u) {
	string siteurl = "";

	using (SPSite site = new SPSite(u)) {
		using (SPWeb web = site.OpenWeb()) {

			if (PublishingWeb.IsPublishingWeb(web)) {
				siteurl = PublishingWeb.GetPublishingWeb(web).DefaultPage.Url;
			}
			else {
				siteurl = web.RootFolder.WelcomePage;
			}
		}
	}

	return siteurl;
}

UPDATE
As it turns out, this code works for sites that have permissions. Since our site is anonymous access, it gives an NT prompt.

The way to fix this issue is to add RunWithElevatedPrivileges.

private string GetSPSiteUrl(string u) {
	string siteurl = "";

	// run this code with elevated privileges
	SPSecurity.RunWithElevatedPrivileges(delegate() {

		using (SPSite site = new SPSite(u)) {
			using (SPWeb web = site.OpenWeb()) {

				// get the default page
                        	if (PublishingWeb.IsPublishingWeb(web)) {
					siteurl = PublishingWeb.GetPublishingWeb(web).DefaultPage.Url;
				}
				else {
					siteurl = web.RootFolder.WelcomePage;
				}
			}
		}
	});

	return siteurl;
}

FireFox Print Bug With MOSS Site

ISSUE
I’ve been assigned the horrifying task of fixing various bugs in MOSS/SP sites at my work. One of the bugs is the inability for FireFox to print documents that span more than one page.

I’ve fixed the issue on another MOSS site but when I went to fix it on another, the same hack didn’t work. I did the same things as I did before. I basically started over on the CSS print style sheet and display: none ‘d everything that shouldn’t be displayed. I also gave everything (*) the values of overflow: visible !important and position: absolute and float: none . None of that worked.

Here’s the rough HTML code:

<div id="ncs">
 <div class="ncs_content">
  <div class="ncs_stage">
   <div class="ncs_stage_top">
    <div class="ncs_stage_content">content...</div>
   </div>
  </div>
 </div>
 <div class="ncs_footer">turned off content</div>
 <div class="ncs_footer_printed_date">print date that needs to be displayed</div>
</div>

My CSS before:

#ncs { border: none; width: 100%; height: 100%; float: none; background: none; }

.ncs_content { background: none; border: none; float: none; }

/* this fixes the FF bug */
.ncs_stage_content {
    float: none;
    overflow: visible !important;
    position: absolute;
    height: auto;
    width: 90%;
    font-size: 14px;
    padding: 20px 0px;
    margin: 10px 0px;
    font-size: 120%;
    clear: both;
    display: block;
}

.ncs_footer { clear: both; height: 100%; position: relative; }

.ncs_footer_printed_date {
    float: left;
    display: block;
    width: 950px;
    position: relative;
    bottom: 0;
    left: 0;
    clear: both;
    height: 120%;
    vertical-align: bottom;
}

The problem with this was it was displaying the ncs_footer_printed_date at the top. I couldn’t for the life of me figure out how to get it to be at the bottom of the content.

I even went so far as to post it on stackoverflow.com . No one could figure it out.

I struggled DAYS with it. This was one of the hardest things I’ve ever had to do. I tried explaining to my boss that I didn’t think it was possible. He said to keep playing with it. So I did but how I get I play with it off and on.

FIX
I had to modify my CSS for everything to be encapsulated in #ncs. Then I had to play around with different styles so that the bottom would be displayed the same as the content. Here’s my finished CSS:

#ncs {
    float: none;
    overflow: visible !important;
    position: absolute;
    height: auto;
    width: 99%;
    font-size: 12px;
    padding: 20px 0px;
    margin: 10px 0px;
    clear: both;
}

.ncs_content { background: none; border: none; float: none; }

.ncs_stage_content, .ncs_stage { margin: 0; padding: 0; float: none; clear: both; font-size: 12px; }

.ncs_footer { display: none; }

.ncs_footer_printed_date { margin: 0px; padding: 0px; width: 750px; font-size: 12px; display: block; }

SPECIAL COMMENT
To my lovely FireFox: Screw you. You’ve known about this bug for EIGHT YEARS and you still haven’t fixed it. It’s a bug with YOUR SOFTWARE. Every other browser (even the more standards compliant ones) can print pages without issues. I find it incredibly ridiculous that you haven’t addressed this issue.

I understand about standards compliance. Microsoft doesn’t make any of their web software (let alone any website they create) W3C XHTML 1.0 compliant like it’s supposed to be. They just don’t care.

But you, you’re supposed to be better than that. You’re supposed to be the best. You’re the top browser. And to have known about this bug for eight years and not get around to fixing it is just shameful.

It’s like saying everyone else’s kid in the marching band is off step except mine. They’re all stupid, apparently.

But it’s no reason to not fix a serious problem. A lot of websites can’t print.

You’re wasting people’s time and you’re making it hard on us web developers. I understand you want to go with standards but at the cost of sanity… especially when most of us can’t edit code that we didn’t make (SHAREPOINT).

I expect better from you, FireFox. I was thinking about switching to another browser because of this idiocracy. But, quite frankly, I love FireBug too much and it’s only available in FireFox.

Please fix this printing issue in your next release. I hear good things from FF 4.0. Hopefully one of them will be an end to this madness. Good night and good luck.

Tackling Prepopulated Email Problem & Annoying Beep In SharePoint

This blog post is actually for two problems with SharePoint I’ve come across.

ISSUE #1
It was requested of me to figure out how to prepopulate the email address in SharePoint login prompts. When you login to SharePoint, if you want to do anything like open a document, you are prompted for your AD (Active Directory) credentials again and again. Needless to say, this is unnecessary and annoying.

FIX #1
After many hours of googling “prepopulate email address in SharePoint”, I actually found the fix in the SharePoint book. It’s called Enabling Automatic Login. The steps are as followed:

On the CLIENT’S computer (aka not the server… aka everyone who uses SharePoint… their actual computer) in IE (make sure it’s Internet Explorer since SharePoint really only works with IE), go to:

Tools –> Internet Options –> click on the Security tab –> select Local Internet –> then click Sites –> Advanced

Under Advanced, the URL of this website should be in the first form field. Click Add. Then Close, then Ok and Ok again.

That should fix the prompting annoyance.

ISSUE #2
When in SharePoint, you click anything (and I mean ANYTHING), there is an annoying beep. It’s like on every link, on every page, everywhere. I don’t have speakers but I have headphones hooked into my computer. Needless to say, I heard the beep with my headphones off, it was that loud. It’s annoying.

FIX #2
This fix is for the client’s computer as well… not the server… not an actual setting in SharePoint (at least none that I could find). So… on the clients computer go to:

Control Panel –> Sounds and Audio Devices –> click on the Sounds tab –> under Program Events scroll down to Windows Explorer –> Information Bar –> under Sounds select (None).

It was driving me crazy!

SPECIAL COMMENT
If the simple fact that you MUST use IE with SharePoint wasn’t enough, there aren’t settings in Central Administration nor on the server that solve minor annoyances like this. Microsoft should have thought about these things before they released this hunk of garbage that is SharePoint. I sincerely hope others realize that Microsoft is just a thug corporation who thinks it owns the world.

They don’t comply with standards, they don’t debug, and they don’t test their products.  We are do their tests for them!

About a year ago I ran into a Microsoft error… Emails were not sending which had both .txt and .vcs files attached to them. (In case you don’t know .vcs files are for Outlook calendars.) No errors, just the emails weren’t sending. What was also weird is that some emails actually WERE getting through… and they all did before. It worked before but all of a sudden stopped working. No server changes, no MS Exchange changes.

I ended up calling Microsoft. They sent me a test program which emailed me a .txt and .vcs file. It wouldn’t work. It turns out the problem was on their end.

In the end, the dude wouldn’t stop bugging me on getting me to help him fix it. I was like “isn’t it your problem now”? They did refund me the ticket since it was their fault.

I think it’s a little ridiculous that these problems are easily fixed on the CLIENT’S side. There should be settings in Central Admin or on the actual site that take care of simple things like this so I don’t need to send out an email or post on how to fix it. The fact that every computer you use that has SharePoint, you must configure IE so those little prompts and sounds don’t drive you up the wall is unbelievable.

We don’t want to be prompted on every link or hear that annoying “blimp” every click. Use some common sense, Microsoft. Good night and good luck.

SharePoint Bug With Firefox

ISSUE
I noticed this around the SharePoint site I’m managing with the Central Administration. When going to select something from a drop down, it doesn’t insert it into the form.

WORK AROUND
Using IE, oddly enough, solves this problem. The selected item is inserted properly into the form.

SPECIAL COMMENT
I’ll begin by saying I am a devoted Mozilla Firefox user. I use IE rarely when Firefox has issues or when TESTING a web application. As a web designer/programmer, I need to make sure that my product can function with any browser. I take the extra step in assuring that my product is fully operational, no matter what browser a user is using. I test my application with Firefox, IE, Safari, and Opera to make sure it works. If it doesn’t, I fix it so that it does work with that browser.

Microsoft programmers, you should be ashamed. To release a tool as powerful and as popular as SharePoint and have it NOT be compatible with one of the most popular browsers as Firefox. How dare you not test your product thoroughly, using multiple browsers. Did you assume that only IE users will use your product? You are wrong, sirs.

If you were to go ahead and make the outrageous requirement to ONLY use IE with SharePoint, why not display an error or a warning message when someone goes to a SharePoint site with a browser other than IE? Seriously. Here I was trying to figure out why it wouldn’t insert my selection when all the while it was because of the browser I was using. Rediculous.

And another thing, why even have this visual show for a simple drop down menu anyway? What a waste of time programming something like that. Why should it open up a completely different window just to insert one little thing? Just make it a simple drop down. Who are you trying to impress? Are we all supposed to be like “ouu, look at that, visually pleasing”. I don’t think so and I am NOT amused.

You wasted my time and my energy trying to research this problem, emailing everyone I could think of who uses SharePoint. Even drafting an email to my boss explaining that I couldn’t do a task because there’s a bug in SharePoint (yeah, that sounds good, right?).

Come on, Microsoft, get with the picture. Good night and good luck.

Deleting A List In SharePoint When You Don’t Have The Options

ISSUE
I ran into this little bug when attempting to create links on the right hand toolbar of my Intranet using MS SharePoint.

I created a list using Create and I made it a Link List (thinking that it was going to be just a regular link on the left toolbar). I some how managed to get my list without any list options like so:

SharePoint Doesn't Have Any Options For This List

I think I created a link then deleted it or something and it took away the options of the Lists for the particular List.

Usually there is a toolbar below the list name with options such as New, Actions, and Settings. Settings has an option of List Settings where you can delete the list that way. I got it so that that option wasn’t there as shown above in my screenshot.

FIX
After about an hour of digging around the Internet, SharePoint, and random trials, I decided to go further into the Site Settings. Under the Site Administration header there’s a link called Site Libraries & Links. I clicked that and from there went to Customize “*your list name here*”. Under the Permissions & Management header on that page, there’s a Delete this List link. Click there, and vuala! The list was deleted.