Thursday, December 11, 2014

SharePoint 2013: Host-named site collections

With SharePoint 2013 it is possible to use host-named site collections. It's pretty cool and might shorten a lot of domains companies use internally for their business units. In SharePoint 2010 the feature was only available for web applications.

To create a host-named site collection (HNSC) you have to use PowerShell:
New-SPSite "" –OwnerAlias “contoso\OWNER" –HostHeaderWebApplication "" –Name "Example" -Description "Exampleportal" -Template “STS#0” -language 1033

With this you create the site collection "Exampleportal" within the web application "". Of course you have to create a DNS entry for this new HNSC.

You might want to use this with a managed path. First we need a new managed path
New-SPManagedPath 'businessunits' -HostHeader

Now you can create your site collection:
New-SPSite "" –OwnerAlias “contoso\OWNER" –HostHeaderWebApplication "" –Name "Example" -Description "Exampleportal" -Template “STS#0” -language 1033

If you want to move existing site collections from path-based site collections to HNSC you will have to backup your site collections and restore it at a new collection.

Sunday, December 7, 2014

Windows Server 2012: How to create a scheduled PowerShell task?

Sometimes you just need to have a task firing at certain times. In my case I had to run a PowerShell script every night. Of course I didn't want to get up every time so I created a scheduled task.

1) Use "Win + Q" or open the search and enter "Task Scheduler"

2) Right click and and look for "Create New Task" in the menu.

3) To add a PowerShell script, first click on "Actions"

4) Under "Program/script:" enter "PowerShell". Next to "Add arguments (optional):" add the path to the script. It won't work if you just enter the path to the script under "Program/script" as far as I know.

And that's it! Now your PowerShell script will run depending on the schedule you implemented.

Thursday, December 4, 2014

Microsoft Sway: What? How?

Microsoft started a Preview of some sorts of Microsoft Sway. At first I was a bit confused in what I should actually do with it. But after using it for a couple of minutes I already knew: I love it.
It's a really easy way to crate presentations of some sorts and works pretty cool so far. Somethings are missing, but will get added later on. Here's a little "How To" on Sway.
If you get a change to take a look at it or want to try it, head over to

Login and select "New". Now all the Sway-Magic can flow!

You can click on "Background Image" to select a back ground image. It doesn't have to be on your computer but practically all over the web.
I decided to use the Microsoft logo which will automatically be displayed in the background as soon as I place it there.
You can add new elements by clicking on the "+", just choose what you need next.
After you clicked on one of the modules it will be added to your "stream". I don't know if there is a name for that thing. The only thing you have to do now is add your text.
Alle the design elements will be automatically handled by Sway.

If you are anything like me, you might love this thing: You just add information to your Sway and won't get bothered by the design. Every styling element is handled by Sway.

Tuesday, December 2, 2014

Office 365: Configure IRM

Configuring IRM in Office 365 is really easy and works really good. So here is what you have to do: 1) Login into Office 365 as an administrator and got to the Office 365 settings page:

2) You can find the "Rights Management" settings under "Service Settings"

3) Click on "Manage"

4) Click on "activate". Office 365 will now create an Azure AD RMS, which is needed to get IRM running on Office 365.

5) Office 365 displays a short message explaining what you are going to activate now.

6) After a couple of seconds rights management will be activated.

7) Now you just have to select a SharePoint Online library and click on "library settings"

8) You will find the listing for "Information Rights Management" under "Permission and Management"

9) There you can find a lot of options to choose from. As always you first have to click on "Show Options" so see everything.

Wednesday, October 8, 2014

SharePoint 2013: Update Displayname of AD Groups after name changes

So, someone changed the AD Group names, which wouldn't be a problem if SharePoint would just get this change on it's on.
But no, I had to write a script to get the changed AD Names. Thankfully I only need to change the display name.
The login name is a GUID which will stay the same even after the AD Group name changed.

In my case I don't have any users which have "s-" in the loginname. If you have, you might want to adjust this part:

SharePoint 2013: Renaming SharePoint Groups with PowerShell

Let's assume you have to rename SharePoint Groups, a lot of them and you have to do it really fast. What will you do? Of course you will use a trainee or PowerShell. I can't give you any advice on trainees, but here's a little PowerShell script. In my example I just need to change a prefix, maybe because the SharePoint groups now belongs to a different company or whatever reason.

Tuesday, September 30, 2014

SharePoint 2013: Update User Information without User Profile Synchronization Service

I had to update user information in SharePoint 2013 without using the User Profile Synchronization Service. I used a PowerShell script to do so. The user, who need an update need be entered in a XML. Here's the script:
Add-PSSnapin Microsoft.SharePoint.PowerShell
Import-Module ActiveDirectory

# Load XML file
$configFile = "PATHtoXML\XMLNAME.xml"
$config = [xml](Get-Content $configFile)

foreach($userName in $config.Users.User)
  Get-SPSite -Limit All | foreach
    $web = $_.RootWeb
    if ($_.WebApplication.UseClaimsAuthentication)
      $claim = New-SPClaimsPrincipal $userName -IdentityType WindowsSamAccountName
      $user = $web | Get-SPUser -Identity $claim -ErrorAction SilentlyContinue
      $user = $web | Get-SPUser -Identity $userName -ErrorAction SilentlyContinue

  if ($user -ne $null)
      #Cut off domain information [AD]
      $parts = $user.toString().Split("\");
      $cutUser = $parts[1]
      # Get all user properties from [AD]
      $adUser = Get-ADUser -Identity $cutUser -Properties *
      $web | Set-SPUser -Identity $user -SyncFromAD
      # Get User Information List [SP]
      $list = $web.SiteUserInfoList
      #Query for user [SP]
      $query = New-Object Microsoft.SharePoint.SPQuery
      $query.Query = "$user"

      foreach($item in $list.GetItems($query))
        #Update the User Information in SharePoint
        $item["WorkPhone"] = $adUser.OfficePhone

And here's the XML:

Thursday, September 25, 2014

SharePoint 2013: Geolocation Field

Back in 2007 I needed to implement a map in SharePoint 2003 / 2007 to show locations like HQs. I decided to go with Virtual Earth, now Bing Maps, and use a xml to provide the actual locations I want to show on the map. It worked, but lets just keep at that. Now, with SharePoint 2013, I heard of this field "Geolocation", but I wasn't able to find it anywhere. Of course I searched the Interwebz and found a couple of blogs and possible solutions, but sadly none of the worked 100% for me. So this is how I finally got the Geolocation field.

First, we need a list, so I created a custon list, which looks like this:

Now we need the field, unfortunately I was not able to add it via UI. PowerShell it is.
Add-PSSnapin Microsoft.SharePoint.PowerShell
$web = Get-SPWeb "http://win-51thg297n5l:31132/sites/cinfo"
$list = $web.Lists["Company Locations"]
$fieldXML = "<field displayname="GLoc" type="Geolocation">"

It should look something like this:

When you are adding an item, you have two options for the location data. I picked the first one, but forgot to create a screenshot for that.

As you can see below, you have this little icon. Click on it an a small map will pop up.

An about that little banner telling you, that you need an account. PowerShell.
Add-PSSnapin Microsoft.SharePoint.PowerShell
$web = Get-SPWeb "http://win-51thg297n5l:31132/sites/cinfo"
$web.AllProperties["BING_MAPS_KEY"] = "YOURKEY"

Something else that is pretty cool: Map View.

The whole process still got some flaws, but I guess that's a problem with the whole cloud-first thing. It seems that SharePoint Online can use this without all this PowerShell stuff. I like this thing, I needed it a long time ago and from time to time, I guess, I will need something like that again. It could be a bit cooler if I could enter a city and Bing would get the coordinates for me, but that is something a workflow of some kind can handle.

Wednesday, September 24, 2014

SharePoint 2010: Get used Databasesize

I needed to know the database size of every database SharePoint 2010 uses. And I also needed information on the size that the database actually needs.
This gave me a little headache but, as always, PowerShell came to rescue me! With this little script you can get the databases, sorted from biggest to smallest, and also how much space they need (in MB)

Get-SPDatabase | Sort-Object disksizerequired -desc | Format-Table @{Label="DB Name"; Expression={$_.Name}}, @{Label="Size"; Expression={$_.disksizerequired/1024/1024}}

Sunday, September 21, 2014

SharePoint 2010: Search and Crawl not working

I got this error message out of the blue:

"Access is denied. Verify that either the Default Content Access Account has access to this repository, or add a crawl rule to crawl this repository. If the repository beeing crawled is a SharePoint repository, verify that the account you are using has "Full Read" permissions on the SharePoint Web Application being crawled."

The crawl account got enough permissions. I also checked the DisableLookbackCheck entry in regedit.
What I missed was: You need to set this setting on every server which is running the search components!

Here's how to:
1) open regedit
2) HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\LSA
3) Add a 32Bit-DWord, Name "DisableLoopbackCheck"
4) Set Value to "1"
5) close regedit, start your crawl and be happy.

I can't stress this enough: Do this for every (EVERY) server which is running search components!

Thursday, September 18, 2014

SharePoint 2013: Metatags or Folder?

It seems that this is still a thing. I thought we've been through folders at the beginning of SharePoint 2010. I thought we were done with them. They were gone. Forever. For good. Never coming back. But I was so, so, so wrong. That's way I'm writing this blog: Don't use folders! They suck. And here's why:

1. Usability
Let's say: I'm creating a document library with 10 folders, also some folders nested within them. And I just tell you "Search for all files in the folder 'Betatest'". You have no idea where this folder is. Have fun clicking through all the folders and subfolders just to find that one folder. Wouldn't it be smarter to use Managed Meta Data Navigation? Yes it would be smarter, because you don't need a refresh everytime you switch a tag. You can first check every tag available and then choose to click on the right one. You still have to search, but you will be much faster. Oh, btw.: You can sort or filter while using meta data. Ever tried this with folders?

2. URL length
This is still a thing and it will still be a thing in the next years. Folders are a part of the URL and the limitation still sucks. Sometimes you simply can't have folder names that are long enough to explain the content. So maybe, just saying, you should use meta data or content types? You should.

3. File URL
Ever created a folder structure and realized you have a typo somewhere? But the link is already sent to everyone who needs to work with it? Well. If you would have used meta data, you would have been able to simply change the meta tag and be done with it.
Or have you tried to move files around? Everytime you have to move them to a different folder, the URL will also change. If you would only change the meta tags, the URL would stay the same.

4. Different views for different users
This is a great thing: Every user could create a view which only displays the data he/she needs. Won't work with folders.

5. Data integrity & duplication
If you allow users to create folders, in the end, they can have a lot of funny names. I found folders named "sharepoint", "Sharepoint", "sharePoint" and "SharePoint". Why not create a meta tag for this and everyone will get it right? Why give users a change for spelling errors? And the other thing about those four folders was: Guess what I found there. Just guess.
Yes, the same damn files, just different timestamps. Well done folders, well done.

6. Why SharePoint and not a file system?
Let's face it: You can have folders on any server, any file system, anywhere. Why spend so much money on SharePoint instead a cheap file system? You will have the same problems with folders on a file system, that's why SharePoint offers meta data. It's so much better than folders, otherwise you are just burning cash.

7. Permissions
I got this a lot. "We can set permissions on a folder and every file in there will have the same permissions. It's super easy and fast!" It is. Until your users are copying the files to different folders. The permission will change, they might loose the file or the wrong people work on the files. If you are using meta tags you might set permission on item level, but they will stay the same as long as they are in this library. Changing a meta tag won't change the permission! Or you just start using a couple of libraries and start setting permissions on library level instead on file level. Anyway: To keep track of every permission set on folders in huge libraries you would have to write a lot of documentation. And trying to keep up with changes might be really hard.

Meta tags rocks. Easy, fast and well-arranged. Shorter, consistent URL. They rock.
Don't use folders. Never.

Tuesday, September 16, 2014

Nintex Workflow 2013: "Something went wrong" / Can't activate Nintex

Well. something clearly went wrong. But what? Except the "Something went wrong" message I got nothing.
I was trying to activate Nintex Workflow 2013 via Internet Explorer and got up to this point.
What was wrong?

I have no idea, but I was able to activate the feature with PowerShell:
$nintex = Get-SPFeature -Identity 0561d315-d5db-4736-929e-26da142812c5
Enable-SPFeature $nintex -URL "THEURL" -Force

How did I get the ID for this feature?
Get-SPFeature | select ID, DisplayName, Scope | Export-Csv C:\FeatureList.csv
With this list, you can get every ID and just activate them with PowerShell.

Monday, September 15, 2014

SharePoint 2010: Hide Tags and Notes

I'm using MySites and also use the Social Features on a couple of sites. But on one of the lists I needed to hide "Tags and Notes" without deactivating the farm feature. I used this CSS for it:
<style type="text/css">
display:none !important;
This "#Ribbon\.ListItem\.TagsAndNotes" will remove the "Tages and Notes from the Ribbon:

You can find the ID via IE Dev Tools:

Monday, August 11, 2014

Windows Server 2012: Start / Stop Services With PowerShell

How can someone start or stop Windows Services with PowerShell? In my case I needed to start / stop SharePoint 2010 / 2013 Services.

To stop services use something on the line of this:

With $services I just create a simple array, which I will use in my foreach. Stop-Service simply stops the service I want to stop. I will also pause the script with .WaitForStatus() until the service reached a certain status, which is "Stopped" in this example.

To start services, it's the same, except that the status changed:

Edit 08/13/14: Had to update the scripts.

Tuesday, August 5, 2014

SharePoint 2010: Designer Workflows won't start

I don't like Sharepoint Designer Workflows, so I never really used them. Lately I had to and it ended in a lot of growing hatred, tears and curses. Boy, do I not like SharePoint Designer. I was finishing up a project and tried to test my Workflows just one more time. They were supposed to start if an item is created. They did not.

What happend? Designer Workflows won't start if you're creating an item as a Farm Administrator or as a System Account in general. At least that's how it seems. Just use a second account and you are good to go.

Is this a normal behavior?

Wednesday, July 30, 2014

SharePoint 2010: Get All Site Collections

How to get all Site Collections from one Web Application?

So here is the script:

$spWebApp = $rSite.WebApplication
$stream = [System.IO.StreamWriter] "FILELOCATION.csv"
foreach($site in $spWebApp.Sites)
$web = $site.RootWeb
$stream.WriteLine($web.Url + "," + $web.Title)

Tuesday, July 22, 2014

SharePoint: Let's talk about Disaster Recovery!

Disaster. It sounds worse than it is, until it happens. Then, it's worse than it sounds. A lot of companies I worked with had some trouble figuring out, how to handle a disaster for SharePoint. Mostly because those companies used tools and processes not designed for SharePoint.

Honestly, I'm not even sure if I found the best way, but it works and seems to be supported by Microsoft. Backup and in the end Restore are a lot more complex and worrisome than many think. So, without further ado: Let's talk backups!

First of all, we need to define what a "disaster" even is. We can, of course, make some suggestions what a disaster might be, but the customer himself needs to define the scenarios applicable to a disaster recovery. I usually only consider the obvious things:
  • Farm is not available (as a whole)
  • some SharePoint Servers are missing
  • SQL Server is not available
 In this case, I have a lot of details I could go into, depending on the farms and SQL installation. And I also only cover problems in which users can't work anymore. I usually don't consider a broken site collection a disaster. That's just business as usual. BUT: It is your decision and the one of your customer, not mine. You might as well but logins of the CEO in there. It's not recommended, but you can do it.

Backup / Restore
The backup-part is the worst in my eyes, because it takes a lot of planning and testing. We could just imagine disaster cases and be happy with that, but a backup needs to be tested. Tested a lot. At least once a year. Once. A. Year. Now you might wonder why I put a lot of emphasis on the fact, that you have to test it over and over again. Simple: A lot of things will happen or might happen on your SharePoint Farm, f. ex. new Solutions, Patches, or your SQL environment, f. ex. Patches, Clustering, new nodes, which ultimately change the backup you are creating. So... One of these things might destroy the plan you have.
It's not only the farm itself. It's also possible that a change in your virtualization environment, f. ex. Hyper-V, VMWare, needs to be considered.
Maybe there are some changes to your backup software that you didn't get a notice of. The only way to guarantee a working backup is: test it over and over again.
And a final aspect is also the restore time. How long until your farm needs to be up and running again? You have to test this, because your content databases will, hopefully, grow.

But how can we create a working backup and restore it?

First of all: Don't you dare to use snapshots. Snapshots are a no-no. Personally I use them only for my development system, because if it crashed I tend to not loose that much information. Especially for production environment I would recommend proper backup mechanics. Snapshots got a lot of problems, because you can't save them independently and it's not consistent. Don't do it, you might have more problems in the end and be forced to reinstall the SharePoint farm. Not the best option I think.

Glad that we settled that. I also recommend to always backup the server as a whole, not just parts of the configuration. If you are using a virtualization environment I don't see a reason not to. Of course you need a lot of disc space and also your network infrastructure needs a lot of power, but using these as arguments against a server backup is just cheap. Always consider this: Is the information I backup vital / important to my business? If yes, you should be able to afford a proper, tested backup concept.

In my opinion it is enough to backup your application servers every couple of weeks, right around the time to change your configuration. Because after changing your configuration, there is no turning back without loosing data. And data is money. Of course you have to backup your SQL databases on  a more regular basis, something like twice a day, depending on the business needs. Also think about using a dedicated window for application server backups, f. ex. the maintenance window. Because in my experience it was pretty hard to get a farm running again, if I just created a backup without shutting down SharePoint. This is something depending on your backup software. Some are able to shut down the services, others are not. Sometimes it works, sometimes it doesn't. I recommend to test a scenario that you would like to have. In my case it's usually: Shut down services, shut down server, backup, done. But it might also work with running servers, that's up to your testing.

Now, let's say you don't have a working backup and want to install the SharePoint farm from scratch. Don't use the configuration database. You would need an identical farm to use the configuration database which is rarely the case. So I would recommend that you just reinstall the farm, f. ex. using PowerShell, and attach the content databases. The configuration will be created anyway.

Since we are already talking about restoring the farm, we might as well continue. If you used running application servers as a backup and did not restore your SQL server / cluster / database first, you will have a lot of funny event log errors to ignore. Restore itself is pretty easy, because you will have to wait until your servers and data is restored.

But what then? Guess what: You have to test. A lot. You should have a test matrix created for cases like this. Usually you just test a couple of standard feature you use a lot, f. ex. Workflows, Metadata, and check a couple of health states, f. ex. are the server up and running?, services?. Depending on your business requirements it can be an easy Excel list with just two rows, it might also be a lot more complex. But always remember: You need to be able to work with the list while under a lot of pressure.

  • create disaster cases
  • create a backup process
  • create a test matrix
  • test your backup
  • be happy.

I tried a lot of solutions that were supposed to work, but in the end didn't. I can only give you this advice: Every solution you think is possible should be tested first, than declared to be true. Keep in mind, that this is just a short summary of things that need to be done. There is a lot more things to do! Don't underestimate this process, it's very time consuming.

Tuesday, July 15, 2014

SharePoint 2010: Move SharePoint Designer Workflows

I had to move a couple of SharePoint Designer Workflows from one farm to another. Because they were stored in a site collection, which also needed to be moved, I decided to use PowerShell to move everything at once.

The SharePoint Workflows did not work after the transition. But why?
Because workflows don't know that they were moved. So now we have to work a bit of xml magic and everything will be fine!

1. Open SharePoint Designer
2. Open your web
3. Click on "All Files"
4. Click on "Workflows"
5. Click on the workflow you want to edit
6. Right-click the *.xoml.wfconfig.xml
7. Open with "SharePoint Designer (Open as xml)
8. Edit the fields marked in the screen shot.

Use this script to get the ID:
$web = Get-SPWeb http://THEWEB
$DocLib = $web.Lists["Workflows"]

This is the List where the workflow is supposed to be running.

Usually it's called "Workflow Tasks" or "WorkflowTasks" and will be visible after you activated "SharePoint Server Publishing Infrastructure". Open the list and copy the ID from the address bar or use PowerShell.

Usually it's called "Workflow History". You can see the list title when trying to add a new workflow: http://YOURSITE/_layouts/AddWrkfl.aspx. Open the list and copy the ID from the address bar or use PowerShell.

Wednesday, June 25, 2014

SharePoint 2010: How to use RunWithElevatedPrivileges

I ran into a bit of a problem, when I needed to change the permissions on an item. Doesn't sound that bad, right? Well, it is, when you only work with an event receiver, which is started by any user. The solution sounded simple, but still took me a while: RunWithElevatedPrivileges.
There are a couple of issues you might come in contact with, so I will try to post a couple of those in this post.

Tips & possible issues:
1. Create everything from scratch!
In one of my first attempts I just used the existing SPWeb I already used. But nope. This will only work, if the user already got enough permissions for his / her actions, which of course means: It did not work. You will have to get your web, lists, items, everthing again if you want to manipulate them with elevated priviledges.

2. Dispose your web!
Yeah, I know: It should always be the case. But believe me, while coding I forgot it twice in my RWEP-code block. The problem with this is pretty simple. The web you were using still exists so it would still be possible to work with this web. Including elevated priviledges. Not that nice, so please just dispose your web.

3. Don't use it all the time!
Yes, you could do that, BUT! you shouldn't. As always use least priviledges need, and for most of the things my event receivers are doing, I don't need a lot of permissions. And so shouldn't you, because otherwise your software concept might have a few problems.

How does it work?
The shortest explanation is this one:
A delegate method that is to run with elevated rights. This method runs under the Application Pool identity, which has site collection administrator privileges on all site collections hosted by that application pool.

And here is the code that made it work:
        using (SPSite site = new SPSite(properties.Web.Url))
              using (SPWeb myWeb = site.OpenWeb())
                     // Add your code!


I only tried this on SharePoint 2010, so maybe it's a bit different on SharePoint 2013 or Office 365.

Monday, June 23, 2014

Office 365: Napa & this App-Thing

To be honest: Everything is an app nowadays, which makes sense. App derived from application, and someone, my guess is Apple, decided to call it "app", because it's shorter and doesn't sound that complex. A concept and a name for the new generation of smartphone, tablet and PC users. And now Microsoft jumped on the band wagon. Well, it was a while ago, but I finally had enough time to check Napa out.

Yesterday I tweeted that I'm going to start to look into apps. Problem is: I'm not a dev, just interested in stuff like this. So this is will be just a first hands-on experience, nothing in-depth, nothing special and of course nothing so solve any problems. Just hands-on. First hands-on.

I simply worked along a tutorial from Microsoft. You will find a link to it in your Office 365 Dev System. Don't get me wrong, but sometimes I have a hard time to start a project. In this case I didn't even know what was going on, because I wasn't sure what Napa actually can do.

For starters: JavaScript & jQuery. And Lots of it. But let's not get ahead of our self. The hole UI is really neat and isn't confusing at all. Everyone who can remember their first time in Visual Studio will know how confusing that was. But take a look at this little snapshot:
Napa in Office 365.
That's it. Nothing more to it. Of course you don't have a lot of features, but my guess is, that you won't need that.
And here's where I'm making a little jump: Just use the tutorial, it's pretty good. I just want to talk about the other stuff.

So, you have your code ready, like I do and you hit the "play" button. A little popup will show up to tell you in which deployment step you are currently at.
Deployment steps in Napa.
While it was deploying my app, I wondered how this thing will start and what it will look like. But luckily Napa is designed for people like me. Click on the link within the popup and your app will show up.
Click on the link.
The first app.
That was easy and fast and free. Yes, it is free to develop with Napa, which is cool. And because it's browser-based (in my case it's Chrome), you can just open your app everywhere and continue coding without needing a development system. But! You need an Office 365 Dev account, which costs something like $99/Year.

While coding, Napa can provide some help, which is also pretty cool and looks create. I like that style.

So after coding my first small app, the biggest question for myself is: Will I ever use this?
Well... I think I will, but I don't know if I will use it like this. Usually when I code I need stuff like permission management, but I don't know if this is possible with Napa and Office 365 Apps.

But I will definitely continue to test Napa and try to port some of my old projects to Office 365, just to see if it would work. 

Saturday, May 24, 2014

ShareCamp 2014 - My first visit

This year I was finally able to get time off to go to ShareCamp near Munich and meet people from the community and listen to a lot of new features, ideas and concepts. I really like the style of community driven events like this one, because it is a lot more open  to different kind of ideas or approaches and stuff you can show off.

I think that this concept is one of the best ones I've seen in a long time. Of course I took a couple of pictures and I gonna post them at the end of this text.  I won't go into too much technical detail, because I want to give you a feeling about how this got done during this weekend.

Let's face it: most of the time, people are just talking and talking and won't show you a lot of stuff. But at ShareCamp I saw a lot of actual work, which was great. Of course you won't be able to get to every lecture (it's sad) which forces you to pick the most interessting for you. In my case I was listening to VMs (SharePoint) in Azure (by Patrick Heyde), Windows Phone 8.1, ShareCoffee (created by Thorsten Hans), SharePoint App Development (AngularJS & REST API) on Saturday. It was more development stuff than I had planned, but what the hell: Sometimes you just have to run with it.

It was a lot of fun to listen to the people who were talking, even when things got a bit bumpy. The picture I took during those lecture aren't that good, but I think it's enough for a little impression.

I liked it a lot and hopefully I will get some of the PowerPoint or codes from the lectures.

Thursday, May 15, 2014

Visual Studio 2010: Event Receiver Name Change

I change the name of an event receiver in my solution, just because I think "EventReceiver1" isn't such a good name. I was sure this thing would work, so I tried to deploy it on my SharePoint 2010 Farm and was stunt when I saw that it wasn't able to activate it.

So what did I do wrong? Simple!
After you change the name of the event receiver make sure you open the Elements.xml and change the name in the <class> attribute accordingly.

I'm still wondering, why something like this isn't done automatically.

Wednesday, May 14, 2014

SharePoint 2010: How to activate Target Audience

I had a bit of trouble, like most days for the last two weeks, to get my coding done. Again, it's because I usually don't code as much as I do at the moment. I need to create a field "Target Audience" and fill it with the correct value. Funny thing so: I shouldn't just create this field as a new Site column or something like that. I need to activate audience targeting first. But: How do I code an activation script of some kind in C#?
You will find two links below with an explanation, but I wanted to post the code anyway so it might be easier to find.

// Activate audience targeting

// Get the list where you want to activate audience targeting
SPList myList = myWeb.Lists["LIST"];
// leave this as it is, only change the "Required" attribute
XmlElement fieldElement = new XmlDocument().CreateElement("Field");
fieldElement.SetAttribute("ID", "61cbb965-1e04-4273-b658-eedaa662f48d");
fieldElement.SetAttribute("Type", "TargetTo");
fieldElement.SetAttribute("Name", "TargetTo");
fieldElement.SetAttribute("DisplayName", "Target Audiences");
fieldElement.SetAttribute("Required", "FALSE");


And here are some more links with information on this topic:

Monday, May 12, 2014

SharePoint 2010: Roll-out files with a solution in C#

Usually I don't tend to code as much as I do right now, which of course means that I'm a bit rusty. So naturally this one freaked me out. How do I deploy files, like JavaScript, CSS, with a solution. Of course I could just copy all the files in afterwards, but I wanted to have a slick solution with just a click of a button.

I ended up using Modules. Click on your project, add a new item and search for "Module".
Now place the files you need in this Module and open the Elements.xml. It will be automatically filled with the files from the Module. But maybe you want to store them in a differen library.
So heres the content of the Elements.xml:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="">
<Module Name="NameOfModule" Url="TargetLibrary">
<File Path="PathWithinTheModule" Url="TargetFolderWithinTheLibrary" Type="GhostableInLibrary" />

I will come back to this post and add a couple of comments, but feel free to comment if you need help with this. Also I will add a couple of screenshots on how to add a module.

SharePoint 2010: Hide Recycle Bin & All Site Content

1. Create a "Content Webpart" somewhere on your SharePoint Page.
2. This is the code to hide it:
<style type="text/css">

SharePoint 2010 / 2013: Create a document library with C#

This is how you create a document library with C# in a farm solution:

Guid myListID;
myListID = myWeb.Lists.Add("LibraryName", "Library Description", SPListTemplateType.DocumentLibrary);
It's pretty easy and mostly self explanatory. I placed this in an event receiver so that I can create document libraries on feature activation. Works pretty good.

Wednesday, May 7, 2014

SharePoint 2010: Create a custom view for a survey

I had a funny little problem: Show specific results from a survey without using jQuery, PowerShell or Excel. Sometimes I wonder how people come up with those problems, but they do. So how did I fix this?

First thought: Of course! A custom view. Yeah, sounds about right, with a couple of filter options and what not. BUT: There is now way of creating a view. The buttons and links are missing. Thanks, exactly what I needed.

To get around this, you just have to use a little bit of magic:
1) Go to the settings page of your survey and copy the link from the addressbar:
2) Now we just use this link und survedit into viewtype: http://DOMAIN/SITE/_layouts/viewtype.aspx?List=LISTID
3) Create your view

Well, that was an easy problem for once.

Thursday, March 20, 2014

SharePoint 2013: Search box drop down / Search Scope

How do I configure the Search Scope in SharePoint 2013? I thought it would be really easy, just click one button and be done with it. But, of course, I was wrong.

This is what I need:

And this is how I got to work:

1) This might seem strange, but you have to create a Search Center site collection first. The search application does not provide one or lets you create one. Talk about usability.

2) After we created a Search Center, we have to pay the search service application a visit. The path would be:
CA -> Application Management -> Manage service applications and then click on your search service application. You should see something like this now:

3) To set a Search Center click on the link "Set a Search Center URL".
Notice the example below! The path has to look something like this: http://domain/SEARCHCENTER/pages
After setting the path, it should look like this:
4) Next on the list is the actual site collection, from where you would like to search. Click on the gear-symbol and choose "Site settings".
5) Now look for Search Settings. You need to do this for the site collection first:
 6)  Check the box as seen below. This will allow you to use the search center. Do NOT enter a search center URL, because it will override the checkbox.
 7) Go back to your site settings and click on "Search Settings" below the "Search" headline.

 8) Again, just check the box an your done. Alternatively you could configure your own search navigation unter "Custom Search Navigation", but I won't go into this today.
 9) Woohoo! We got the drop down and saved the day. Job well done!