Featured Posts

SharePoint Provider Hosted Apps Tips and Tricks - Introduction I am starting a tips and tricks blog series on building Provider Hosted Apps in SharePoint. All posts in these series will be categorized appropriately and can be referenced from this link: http://www.greggalipeau.com/category/sharepoint-2013/apps/sharepoint-provider-hosted-apps-tips-and-tricks-series/ So,...

Read more

A Better Enhanced SharePoint 2010 Floating Ribbon SharePoint 2010 has issues with its scrolling because of the way it implemented the fixed ribbon. Before we look into these issues (and a workaround) let's first try to understand what SharePoint is doing....

Read more

Tips and Tricks for setting up a SharePoint 2010 development... While SharePoint 2010 is similar to SharePoint 2007, there are many tips and tricks to setting up a proper SharePoint 2010 development environment. Some of these are the same as SharePoint 2007 and some...

Read more

Developing SharePoint WebParts using User Controls... If you’ve read my blogs before, then you probably know I am a fan of WSPBuilder (http://www.codeplex.com/wspbuilder). I like the intuitive nature and flexibility of the product. It really helps with...

Read more

Cleaning up your WebPart Gallery Deploying webparts in SharePoint can be difficult (when you are learning) because of the many ways to do it. You can manually add webparts to the WebPart gallery, you can add WebParts through features...

Read more

  • Prev
  • Next

Breadcrumb in SharePoint 2013

Category : SharePoint 2013

A great functionality of SharePoint 2010 is the breadcrumb:
SP 2010 Breadcrumb

In fact, one of the most common questions I get in my training courses is how to get back home. Most of my clients have sub-sites within sub-sites. And, as much as I help them organize their structure, there is no getting around multiple layers of sub-sites in enterprise SharePoint implementations.

So, as I move clients to Office365 and SharePoint 2013, I am surprised to see  the breadcrumb does not exist. I assume that Microsoft wants the default site to work for both internal and external facing sites now, so they removed this by default. Thus, I did what any developer does – I looked at the code.

Turns out, it’s there! They just hide it in the master page for some reason. So, if you want it back, modify your master page.

Note: There are a few ways to modify your master page. You can copy the seatlle.master and create a clone in SharePoint designer (http://tinyurl.com/qfsar62)  and set that as your master page. You can use the new html convert to master page (my personal favorite)  - http://tinyurl.com/kso8hzv. It really doesn’t matter “how” you modify your master page for this article. I am just going to show you “what” to modify within the master page to get your breadcrumb back.

So, lets look at the out-of-the-box seattle.master.

  1. Just do a quick search on the word class=”ms-breadcrumb-dropdownBox”.
  2. Remove style=”display:none” from the div tag for class=”ms-breadcrumb-dropdownBox”
  3. Remove Visible=”false” from the properties for theSharePoint:PopoutMenu
  4. Optional: if you used the html to master page conversion, you might need to remove the property ThemeKey=”v15breadcrumb”. If you don’t do this the folder might not show.

That’s it. As you can see, the breadcrumb is there. Microsoft just hide it in the seattle.master. So, we just need to show it.

SP 2013 Breadcrumb

In fact, I actually like this breadcrumb better than 2010. It shows right in the Global Navigation. I feel that is much more intuitive for the end user.

Caveat: One thing I noticed on my site is that I had to turn the publishing feature on for my sub-sites or they wouldn’t get the breadcrumb.

Create SharePoint 2013 site collection with Powershell

Category : SharePoint 2013

I had a requirement recently to create a SharePoint 2013 site collection with Powershell. Sounded easy enough. I went to my trusty Google to see if anyone else had done it before. The answer was – kind of. I found a lot of posts with sections of code. But, nothing with a complete answer. I had all the gottchas (publishing sites, setting up permission groups, managed paths, creating a new database for the site collection, etc…). So, I put the following together. Hopefully it helps someone else.

Caveat: This script will not meet everyone’s requirements, nor is it intended to. It contains “a lot” of requirements in it. Please use, parse, do whatever you want with it at your own discretion. But, please do not assume it will just work in every single environment with everyone’s requirements. So, basically use at your own risk!


Add-PSSnapin Microsoft.SharePoint.PowerShell –ErrorAction SilentlyContinue
$sitename = Read-Host "Enter Site Url Name (no spaces)"
$sitedisplayname = Read-Host "Enter Site Display Name"
$managedpath = Read-Host "Enter Managed Path"
$server = Read-Host "Enter SQL Server"
$dbname = "WSS_Content_$sitename"
$webapp = Read-Host "Enter Web App url (ex: http://mySharPointsite)"
$siteurl = "$webapp/$managedpath/$sitename"
$masterpagename = Read-Host "Enter Master Page (ex: mycustommasterpage.master)"
$MasterPageUrl = "/$managedpath/$sitename/_catalogs/masterpage/$masterpagename"
$domain = Read-Host "Enter your Organizations Domain"
$owner1Name = Read-Host "Enter Primary Site Collection Admin - {username}"
$owner1 = "$domain\$owner1Name"
$owner2 = "$domain\$env:username"
$assignEveryVisitor = Read-Host "Do you want to assign 'everyone' read-only rights to this site by default? (Y or N)"

#Create Database and Site
Write-Host ""
Write-Host "Creating site at" $siteurl ". Please be patient, this might take a minute"
New-SPContentDatabase -Name $dbname -DatabaseServer $server -WebApplication $webapp | out-null
New-SPSite -URL $siteurl –Template "STS#0" -Name $sitedisplayname -OwnerAlias $owner1 -SecondaryOwnerAlias $owner2 -ContentDatabase $dbname | out-null
Get-SPContentDatabase -Site $siteurl | Set-SPContentDatabase -MaxSiteCount 1 -WarningSiteCount 0
Write-Host ""
Write-Host "Site Collection at" $siteurl "has been created in the" $dbname
Write-Host ""

#Enable the Features
Write-Host "Enabling Features"
Enable-SPFeature –Identity PublishingSite –url $siteurl
Enable-SPFeature –Identity PublishingWeb –url $siteurl
Enable-SPFeature –Identity Workflows –url $siteurl

#Open the site in a SharePoint Object
Write-Host "Opening site"
$site = New-Object Microsoft.SharePoint.SPSite($siteUrl)
$web = $site.OpenWeb()

Write-Host "Setting Master Page" to $MasterPageUrl
$web.MasterUrl = $MasterPageUrl
$web.CustomMasterUrl = $MasterPageUrl

Write-Host "Create Security Groups"
$owner = $web.Site.RootWeb.EnsureUser($owner1)

#Site Collection Admin
$admin = $web.Site.RootWeb.EnsureUser($owner1)
$admin.IsSiteAdmin = "True"
$admin.Update()

# Owner Group
$web.SiteGroups.Add(“$web Owners”, $owner, $owner, “Use this group to grant people full control permissions to the $web site”)
$ownerGroup = $web.SiteGroups["$web Owners"]
$ownerGroup.AllowMembersEditMembership = $true
$ownerGroup.Update()

# Members Group
$web.SiteGroups.Add(“$web Members”, $owner, $owner, “Use this group to grant people contribute permissions to the $web site”)
$membersGroup = $web.SiteGroups["$web Members"]
$membersGroup.AllowMembersEditMembership = $true
$membersGroup.Update()

# Visitors Group
$web.SiteGroups.Add(“$web Visitors”, $owner, $owner, “Use this group to grant people read permissions to the $web site”)
$visitorsGroup = $web.SiteGroups["$web Visitors"]
$visitorsGroup.AllowMembersEditMembership = $true
$visitorsGroup.Update()

###### Create a new assignment (group and permission level pair) which will be added to the web object
$ownerGroupAssignment = new-object Microsoft.SharePoint.SPRoleAssignment($ownerGroup)
$membersGroupAssignment = new-object Microsoft.SharePoint.SPRoleAssignment($membersGroup)
$visitorsGroupAssignment = new-object Microsoft.SharePoint.SPRoleAssignment($visitorsGroup)

###### Get the permission levels to apply to the new groups
$ownerRoleDefinition = $web.Site.RootWeb.RoleDefinitions["Full Control"]
$membersRoleDefinition = $web.Site.RootWeb.RoleDefinitions["Contribute"]
$visitorsRoleDefinition = $web.Site.RootWeb.RoleDefinitions["Read"]

###### Assign the groups the appropriate permission level
$ownerGroupAssignment.RoleDefinitionBindings.Add($ownerRoleDefinition)
$membersGroupAssignment.RoleDefinitionBindings.Add($membersRoleDefinition)
$visitorsGroupAssignment.RoleDefinitionBindings.Add($visitorsRoleDefinition)

###### Add the groups with the permission level to the site
$web.RoleAssignments.Add($ownerGroupAssignment)
$web.RoleAssignments.Add($membersGroupAssignment)
$web.RoleAssignments.Add($visitorsGroupAssignment)

if($assignEveryVisitor -eq "Y") {
	$user = $web.Site.RootWeb.EnsureUser(“Everyone”)
	$visitorsGroup.AddUser($user)
}

Write-Host "Updating Web"

Write-Host "***********FINISHED*********** Site Collection at" $siteurl "has been configured"
$web.Update();
$web.Dispose()

SharePoint 2013 Session State – Tips & Tricks Series

Category : RePoint

Just posted an article on my Companies blog in our new SharePoint Tips & Tricks Series: http://www.repointtechnologies.com/Blog/Post/9/SharePoint-2013-Session-State—Tips—Tricks-Series

SharePoint 2013 Out of Box Web Parts

Category : SharePoint 2013, sharepoint, webpart

I rarely re-post other people’s blog articles. But, Laura Rogers did a great job at breaking down the Out of the Box WebParts in SharePoint 2013. So, really I am just blogging this so I have my own reference: http://www.wonderlaura.com/Lists/Posts/Post.aspx?ID=214

SharePoint 2013 Provider Hosted Apps with Javascript – JSOM and Cross Domain Calls

Category : Apps, SharePoint 2013, SharePoint Provider Hosted Apps Tips and Tricks Series, sharepoint

SharePoint 2013 Apps – so many options, so many options. SharePoint Hosted, Provider Hosted, Auto Hosted. Ok, for the purposes of this post we picked Provider Hosted. Why? It meets the criteria of our requirements (specifically being able to use other code bases and hosting off the SharePoint farm).

But, wait, there’s more choices when I pick provider hosted. Do I use Client Side Object Model (CSOM) or JSOM (JavaScript Object Model)? Well, the answer depends on your architecture. If you are writing .Net code, then CSOM makes sense. If you are writing any other code base or a pure JavaScript app, then JSOM makes sense. Well, we want to use JavaScript. No postbacks, nice looking animations/loading symbols – basically, a first class App.

Whew! We made up our minds on options. Ok, now what? Lot’s more options. Provider Hosted Apps are really a blank slate. We are responsible for loading the SharePoint javascript files, Chrome, etc… So, to make life easier, I decided to create a SharePointController.js file that loads up the SharePoint context for the App and Host. Now I have one file to drop into any of my Provider Hosted solutions to load the SharePoint context correctly.

Note: This post is about using the Javascript Object Model and utilizing the SharePoint Context. It is not about the Client Object Model. If you want to use that then there is already a TokenHelper.cs created for you when you create the solution. But, once again, that’s not our requirement. I am just trying to be really clear about the situation we are describing in this post. I feel that most posts about the SharePoint App model don’t do a good job at describing their situation. So, once again for clarity, we are using: SharePoint Provider Hosted and the Javascript Object Model

Let me walk you through a whole scenario of how to use this.

Walkthrough

  1. Create a new Visual Studio SharePoint 2013 Provider Hosted App – if you don’t know how to do that yet, this blog might be a little too far along for you at this point.
  2. Open up the AppManifes.xml (in the App project of your solution) and give your App read-rights to the Host Web. This is important because we are reading from the host web for the purposes of this demo. In real life you might have to give different types of permissions based on what you are doing. Always remember – give the minimal amount of permissions necessary for your requirements.
  3. Go to the Default.aspx.cs file in your Web Project and comment out the code in the Page_Load. That code is the TokenHelper that gets the context for CSOM. But, we aren’t doing CSOM, so we can comment it all out for now.
  4. Drop the SharePointController.js file in the Scripts folder of your Web project of your solution.
  5. Create another JavaScript file in your Scripts folder. Call it App.js. This will be your main JavaScript file. Add the following code:

    
    function SharePointLoaded() {
        //This is just an example of a JSOM call we can make now that the appContextSite is loaded
        this.web = appContextSite.get_web();
        context.load(this.web);
    
        context.executeQueryAsync(
            Function.createDelegate(this, successHandler),
            Function.createDelegate(this, errorHandler)
        );
    }
    
    function successHandler() {
        alert("Succesffully created cross-domain call. Host website name is: " + web.get_title());
    }
    
    function errorHandler(data, errorCode, errorMessage) {
        alert("Could not complete cross-domain call");
    }
    
    var spController = new SharePointController();
    spController.go();
    

Basically, all we did was instantiate our SharePoint Controller class. That class calls a function called SharePointLoaded when finished. At this point SharePoint is completely loaded up and we access to our appContextSite (which is really the host web) and the context (which is really the app web).

So, in the example above we are reading (remember we gave read access earlier) to the host web to get the title. Not the most robust example. But, it proves the point. We just use a Provider Hosted App to make a cross-domain call back into SharePoint successfully. Now our options are completely opened. I can write, host, do whatever I want with my Website and talk to SharePoint. Pretty cool stuff!

But wait! We aren’t done yet. Still one more thing left to do. Go to your Default.aspx page and register the Script files we just added.


<head runat="server">
    <title></title>

    <script type="text/javascript" src="//ajax.aspnetcdn.com/ajax/4.0/1/MicrosoftAjax.js"></script>
    <script type="text/javascript" src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="../Scripts/SharePointController.js"></script>
    <script type="text/javascript" src="../Scripts/App.js"></script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <!-- Chrome control placeholder -->
        <div id="chrome_ctrl_placeholder"></div>  

        Test
    </div>
    </form>
</body>
</html>

Couple very important point about the html above:

  • We first register Ajax and jQuery. These are very important frameworks for the SharePoint JavaScript to work
  • Next we register the SharePointController.js before the App.js
  • Lastly we put the Chrome control placeholder in the right place.

What is that Chrome Control Placeholder?

Well, the chrome control is the logo and title associated with your app. This is a common placeholder that gets added automatically with SharePoint hosted apps. But, you have to add it with Provider Hosted apps. The SharePointController.js takes care of all the hard JavaScript to do this. All you have to do is is make sure the placehoder is there.

Are we done yet?

Yes and No. Everything is technically done. But, go ahead, try to debug your solution. It’s not going to work. Why not? Well, Microsoft, in it’s infinite wisdom decided it wouldn’t provide the AppWebUrl (which is necessary to create the cross domain request) unless a SharePoint element is added to the App project. A SharePoint element can be anything from a List, Workflow, Module, Element, etc… I guess Microsoft “assumed” we developers never need to access the SharePoint AppWebUrl unless one of those exist. But, this assumptions is so wrong I can’t even describe it. There are so many other reasons to want this information. I don’t want to go into the technical details, but this is a big oversight on their part. So, you have two choices:

  1. Go ahead an add a List, Workflow or anything else you might need for your requirements to the “App” project in your solution.
  2. Hack it up – Go to the “App” project in the solution, right click, Add – New Item, and choose Empty Element. We aren’t going to do anything with this element. But, by adding it SharePoint will pass the AppWebUrl to the SharePointController in the query strings.

Advanced Explanation -for those who want to know what I did in the SharePoint Controller

First, get the code from here to walk through with me: SharePointController.js

  1. We first get the hostweburl and the appweburl from the querystrings. The host web is your SharePoint site’s url. The app web is your apps url. Remember earlier when we had to add a SharePoint element to our project. This is why. That appweburl is empty unless there is a SharePoint element getting deployed.
  2. Next we load up our SharePoint JavaScript files. Notice how I load them inside a “getScript”. This is a technique in jQuery that says don’t load the next JavaScript file until the previous one finishes. This is “really” important because some of the inner JavaScript files rely on the previous ones.
  3. When SP.UI.Controls.js loads up it calls renderChrome. That is the JavaScript function that fills in the SharePoint chrome we talked about earlier
  4. When SP.RequestExecutor.js loads up it calls registerContextAndProxy – this is the real Cross Domain magic. SharePoint provides a lightly documented SP.ProxyWebRequestExecutorFactor. That is the key to this solution.

Adding List Views to SharePoint 2013 Apps

2

Category : Apps, SharePoint 2013, sharepoint

I thought this was an easy task – I was wrong. I mean, Microsoft makes it sound like an easy task. I even found it on one of their official SharePoint 2013 training modules. But, they have it wrong. Yes, you heard me right, the official training is not correct. Well, I might be a little harsh. What they say works, but it causes unexpected side affects.

Before I get too far ahead of myself, let me digress a little. First off, it’s getting quite frustrating to read articles from Microsoft or other Bloggers on SharePoint 2013 Apps because they rarely tell us which app model (Auto, SharePoint or Provider hosted) they are referring too. So, let me be clear, this post is only intended for Auto or SharePoint hosted apps. So far, I do not see a way to add List Views to Provider hosted Apps. There is a real good reason for it. The Provider hosted model does not have the SharePoint dlls on the server you are hosting the code on (well, that’s typical, I guess you could import them over if you wanted to or use a SharePoint box as your provider). So, the ASP.Net references I am going to mention (i.e.: the assemblies/dll references for the List View) don’t actually exist on your provider (typically).

Ok, lets start then. My requirement is pretty simple. Add the Workflow Task List to a page in my SharePoint App and default it to the “My Items” view.

Microsoft’s recommendation for adding a List View to a SharePoint App. Just add the following to your page:


    <WebPartPages:WebPartZone runat="server" FrameType="None" ID="TaskListZone" >
        <WebPartPages:XsltListViewWebPart runat="server"
            ListUrl="Lists/WorkflowTaskList"
            IsIncluded="True"
            PageType="PAGE_NORMALVIEW"
            Default="False"
            ViewContentTypeId="0x"
        </WebPartPages:XsltListViewWebPart>
    </WebPartPages:WebPartZone> 

Easy enough. I did it. It seemed to work. Well, did it now??? I went back to my app a few weeks later and notice multiple WebParts in the zone. How did this happen? I only put one WebPart in the Zone. Well, it turns out, every time I updated my app it added another WebPart to the zone. That’s a little frustrating. I am sure it is just a setting somewhere. But, I have an App to build, I don’t have time to track down why this is happening now.

So, my next requirement is to show a particular view(the MyItems view). So, I went to the XSLTListViewWebPart documentation to see which property I need to set to define the actual “view”. Man, that documentation is difficult to follow. I spent a while on this and figured I might be barking up the wrong tree.

So, I took a step back. You know what – I never did it this way in SharePoint 2010 or when building full trust code. I always deployed WebParts in modules. The only reason I was even doing it this was is because I saw it in the SharePoint 2013 App trainings from Microsoft. Could it be possible those trainings weren’t showing me the best practice? No, that can’t be. So, I decided to do this how I believe best practices are with SharePoint – in the elements.xml file that deploys the page.

So, first I added the WebPart Zone in the page with no XSLTListViewWebPart in it:


<WebPartPages:WebPartZone runat="server" FrameType="None" ID="TaskListZone" /> 

Next I went to my elements.xml that deploys my actual webpage to the app. Then I simply added the View to the appropriate WebZone in the elements.xml. Thus, when the page gets deployed the WebPart gets added to the correct zone:


<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="Pages">
       <File Path="Pages\Tasks.aspx" Url="Pages/Tasks.aspx" ReplaceContent="TRUE">
      <View List="Lists/WorkflowTaskList" BaseViewID="5" WebPartZoneID="TaskListZone" WebPartOrder="1">
        <![CDATA[
          <webParts>
              <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
                  <metaData>
                      <type name="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart,Microsoft.SharePoint,Version=14.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" />
                      <importErrorMessage>Cannot import this Web Part.</importErrorMessage>
                  </metaData>
                  <data>
                      <properties>
                          <property name="Title" type="string">My Tasks</property>
                          <property name="InplaceSearchEnabled" type="bool">False</property>
                          <property name="ShowToolbarWithRibbon" type="bool">False</property>
                      </properties>
                  </data>
              </webPart>
          </webParts>
      ]]>
      </View>
    </File>
  </Module>
</Elements>

All is well with the world now. I have complete control over all my properties (event he BaseViewId to set my “MyItems” view for the list). Also, no more duplicate WebParts in the zone.

So, what is the lesson here folks – trust my experience with best practices and stop thinking everything in the SharePoint App trainings is correct. But, I still recommend the trainings from Microsoft. Mostly they’ve steered me in the right direction.

I’m Hiring!

Category : Uncategorized

That’s right! My Company, RePoint Technologies is hiring talented SharePoint Developers. Come work in an innovative, fun environment. And, best of all, you get to work with me! If interested, please contact admin@repointtechnologies.com

Do you want to be part of something new? Do you want to work in an organization where the CEO is a developer just like you? Do you want to work in an organization where quality trumps politics, good ideas are encouraged and latest technologies are implemented? If so, RePoint Technologies is the place for you.

RePoint Technologies is a new company focused on SharePoint and .Net. Our founders are SharePoint Architects that want to revolutionize the SharePoint consulting industry. When is the last time you’ve seen a job opportunity where you can be at the ground floor of something like this? You’ll get to work with thought leaders in the area and help mold a company at the same time.

RePoint Technologies is looking for full-time, 1099 or contract-to-perm for work at a large Government Agency. This position will write SharePoint Designer Workflows and document the implementation. Possible work with Nintex and Custom Webparts is available too.

Two positions available – Senior and Mid level with Workflow experience. Remote work is possible. Must be US Government Clearable.

In addition to project work, internal product development opportunities available. RePoint Technologies builds apps for the new SharePoint/Office 2013 app store. Not only do we build apps, we build the best apps. Don’t believe us? Well, RePoint Technologies won the inaugural App development contest for the app store with our Mind-O-Mapper app. When you join us, you know you are working with the best.

Skills:
- SharePoint 2010 or SharePoint 2013
- SharePoint Designer Workflows
- SharePoint Webpart development experience
- Understanding of the SharePoint API and how to code against it
- Excellent verbal and writing skills

SharePoint 2013 dynamic JavaScript and Minimal Downloads: the _layouts/15/start.aspx# conundrum

1

Category : SharePoint 2013

Today I needed JavaScript to load when my page loads in SharePoint 2013. Easy task. I’ve done this a hundred times in SharePoint versions past. But, for some reason it wasn’t working in SharePoint 2013. I tried _spBodyOnLoadFunctionNames and document.ready in jQuery. Neither worked. Weird, huh?

Well, the issue is because of a new feature in SharePoint 2013 – Minimal Download Strategy. Have you ever looked at the URL of a SharePoint 2013 site and seen _layouts/15/start.aspx in it (ex: _layouts/15/start.aspx#/SitePages/Home.aspx)? This is SharePoint 2013′s Minimal Download Strategy. It’s a “smart” feature of SharePoint 2013 that renders only the changed content on a page. It’s suppose to load the page up quicker. Well, it’s not “smart” enough to know we want to  dynamically load of JavaScript to change our page on load.

So, just go to Site Settings  –> Site Actions –> Manage Site Features. Then deactivate the “Minimal Download Strategy” feature. Problem solved.

Obviously you have to take into account what’s happening on your page to ensure you are not hurting your page performance when doing this. So, take this with a grain of salt (i.e.: use some reasoning before implementing).

Also, I realize the next obvious question is “what if I want Minimal Downloads?”. Well, there seems to be a way to do this in certain situations. In my particular situation I couldn’t get these techniques to work (because I was using an in page script editor). But, if you are developing a component here is the strategy to get it to work:
http://tech.bool.se/make-javascript-code-work-with-minimal-download-strategy-part-1

http://tech.bool.se/make-javascript-code-work-with-minimal-download-strategy-part-2

Speaking at Capital Area .Net SharePoint Special Interest Group

Category : Presenting

Please join me 9/18 for my presentation on Creating an MVVM application in SharePoint using Knockout.js. http://www.meetup.com/CapArea-NET-SPSIG/events/124099412/

SharePoint Public Facing – remove plugin prompt

1

Category : Master Pages, SharePoint 2010, SharePoint 2013, sharepoint

Here’s an oldy, but a goody (well, if we consider SharePoint 2010 public sites oldies). Don’t worry, it works in SharePoint 2013 also.

Have you tried to build a public facing SharePoint site and you get plugin prompts on some browsers (Chrome, Safari, etc…)? Even worse, sometimes these show up as plugin errors. Do you know what that is? It’s the ActiveX IM markers in SharePoint trying to ask you if you want to install. These are those little symbols that show up next to peoples names in SharePoint so you know whether they are online or not.

That’s weird – what anonymous, public facing site needs IM markers? These are anoymous sites that people don’t log into unless editing content (usually). Well, the reasoning is pretty simple, the code runs on “all” SharePoint sites because it is located in the init.js file.

But, it’s easy to turn off. All you have to do is override the javascript functions in your master page. Just place the following code in your Master Page (I typically put it right before the closing of my head tag):


<script type="text/javascript">
function ProcessImn(){}
function ProcessImnMarkers(){}
</script>

Pretty simple huh? All it does is override the functions that call this code.

But wait! What if you want IM markers when people log into your SharePoint site. Well, it’s possible. Did you know that it’s possible to wrap code in special controls called SPSecurityTrimmedControls. These controls determine a users access levels and then either writes the html/js to the page or not. This article is not really about SPSecurityTrimmed controls. You can read about them here: http://blogs.technet.com/b/chad/archive/2009/12/03/tip-12_3a00_-hide-in-plain-view-with-sharepoint_3a00_spsecuritytrimmedcontrol.aspx or here http://whitepages.unlimitedviz.com/2013/03/how-to-display-specific-content-to-anonymous-or-authenticated-users-in-sharepoint/. So, if you “really” think you need IM markers for logged in users, see if you can get creative with the SPSecurityTrimmedControls and wrap the code I mentioned above.

That’s my quick tip for the day. Look for more to come.