Posts

Showing posts from 2016

SharePoint 2010 "Navigate Up" points to the wrong URL

Image
Today I had a problem with the "Navigate Up" button in SharePoint 2010. The server moved once to a new URL, but the navigation was still pointing to the old one. The internet told me to change the masterpage.

How to embed an image into your WPF application

If you are building an WPF application you could need images as background or as buttons or whatever. With your  first build or debug you will see the images will be stored in a folder that should not change. If you change it the application cannot find its images and crashes. So if your installing this application you will need to make sure the pictures are in the exact place. There are possibilities to make the path of the path dynamic, but even that is not the best solution.  So how to make sure your files will be where your application will be.  The solution is to embed the images, but how..? Of course there are some hacks you need to know. First of all you need to right click on your project in Visual Studio. Go to "Properties" and then "Resources". Add a resource and choose existing file. Choose your image.

Refresh the User Information List in SharePoint

If you are going into the User Information List, you will sometimes see it is not up to date. There are two jobs (User Profile to SharePoint Quick Sync and User Profile to SharePoint Full Sync). The quick sync will only add new member into your list and somehow it does not work sometimes. So you need to trigger the full sync. The question is how.. there is no point in the UI to do so and not even PowerShell is able to start it. The good old stsadm will rescue us. There are two commands you need to execute in your SharePoint Managing Shell (as administrator).

SharePoint get field by GUID with PowerShell

Once I was looking for a problem in SharePoint, I've spent some time digging the ULS Logs. There was an error with the message " Failed caching field with id '{GUID}' ". The first problem I had was the question: which field? So I decided to build a script that returns the name of the field. After I knew the name, I wanted to know where the field is used, so I extended the script. Now it returns the Lists and Content Types where the field is in use.

How to make sure only one instance is running

Some application cannot be run in multiple instance for several reasons. So you need to avoid a second instance will run, but how? You cannot directly block the execution of your application, so you need to take care of the problem in your code.

Excel column letters into number

Sometimes you need to loop cells in Excel. In fact it is looping rows and columns, because cells have two dimensions. The rows are counted up, but the columns are named alphabetic. Looping them is not that easy and gets harder until you hit the Z , because the next 'letter' would be AA . So a number would be more easy.

Redirect in SharePoint provider hosted Add Ins

If you are using an asp:hyperlink to another page in your provider hosted app you will see the SharePointContextProvider will not be able to handle the redirect. To fix the problem you need to add a click event and call a redirect in your code behind.

register and debug provider hosted SharePoint Online Add Ins with tenant full controll

It is a while since Microsoft launched the Add In (or App) architecture for SharePoint, but there are still things they change or we are not familiar with. In August 2016 there was a change in giving tenant permissions to provider hosted Add Ins using app-only mode and Azure Access Control Service (ACS).

updating multiple list items in SharePoint with JavaScript without using promisses or other stuff

You maybe know the problem; you are updating or creating a set of items using the JSOM and the changes are made to only one item. The  reason is that the process in the back (Event Receiver etc.) can handle only one item at the same time and if it takes to long it misses the update event for the other items. So you need to make sure the update waits until the update before is done. The deal is that the JSOM context works asynchronous. Some of you are using promisses or methods like that. I made a solution that is working without any other library.

using jQuery in TypeScript with Visual Studio Code

If you are building a TypeScript project in Visual Studio Code you will get intellisense and that is cool. But if you want to add jQuery into your ts file the intellisense shows you errors. So how to use it? All you need to do are some simple steps.

Wait dialog in SharePoint 2013 with JavaScript

Some actions in SharePoint (e.g. executing querys) can take a while. You want the user to not do any action or even change the data while your process is running. So you need the wait dialog that SharePoint is displaying some time. Calling the dialog is pretty easy. All you need is a line of code.

Refresh SharePoint ListView without refreshing the page

Of course you have once updated a SharePoint listitem out of the list view. To display the results you've updated the whole page. But you do not need to. With this simple statement you can update the view without any redirect or refreshing of the page:

ClientSideRendering basics 2

Image
In my last post  I extended the view of a list. The goal was to add the unit of measurement next to a numeric value. Now I want to extend it by adding the unit into the forms (new, edit and display) of this list. This is how the form usually looks like: At first we need to write the code.

ClientSideRendering basics

Image
Lists in SharePoint 2013 are very minimal and nice looking. You can have multiple use cases for a list. For example a list of cars. I made a very simple list of cars with three columns: We can see the title the power and the manufacturer, but what is the unit of measurement for the power? To answer this question we should build in the unit.

SharePoint Views [Me]-Filter in Schema.xml

Image
Everybody knows the [Me]-Filter in views. It is a nice way to help me seeing my items. This filter is set in SharePoint pretty fast.. you just need to modify you view, scroll down to the filter region and select a person field and show it if its equals the value "[Me]". It looks like this:

jQuery set the click event the right way

Everybody should know multiple ways how to set click events in JavaScript and jQuery. But if there are multiple different ways which one is the right one? First of all what ways do we have? There are the declaratively ways: 1 2 3 4 5 <!-- declaratively example one --> <a href= "javascript:myFunction()" > click me </a> <!-- declaratively example two --> <button onclick= "myFunction()" > Click me </button>

replace all in JavaScript

Maybe you already had the problem that you needed to use a a simple replace in JavaScript. The problem is while using "string.replace('old string', 'new string')" just the first match will be replaced. This is kind of weird if you are coming from the .Net world. So there are two ways to perform a replace all in JavaScript: the replacing with arrays and the regex replacing

is the DateTime empty?

Have you ever tryied to check a DateTime for the state "not set"? Some of you would say "this is easy, I will check the variable for null" like this: 1 2 3 4 if (myDateTime == null ) { // it is empty } The funny fact is: this will never work. But why?

Loading JavaScript files dynamicly and waiting async for it

Have you ever been trying to load JavaScript dynamicly? That is a cool way to reduce the initial loading time, but there are way more usecases for it. The question is: how to do it?