Wednesday, April 27, 2016

Use “runas” when testing different user roles

A common scenario when testing SharePoint is to switch between multiple user accounts to imitate different user roles. A normal way to do this is to use SharePoints “sign in as a different user” function or right click on a browser/program and use the “run as a different user” function in windows.

The first method can result in you are sign in as the current user when you are browsers other resources dependent on your internet explorer settings.

The second will solve this problem. But you need to enter username and password each time you start a new browser session.

To overcome you need to enter username and password each time. You can use the “runas” program call from a .bat file. With the syntax like this, can you indicate the username. And you only need to enter the password the first time you run the .bat file:

runas /user:[domain\username] /savecred “[path to browser/program]”

e.g.

runas /user:domain\SP13TestAO1 /savecred "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"

And create a .bat file for each user role, it is easy to switch between user session:

image

Monday, April 25, 2016

WebAPI plain text response

I got a problem where the solution was to create a globe JavaScript object and I need to render the data on the server.

I would like to use the JavaScript object like:

<span id="text"></span>
<script>
var d = document.getElementById("text");
d.innerText = resources.hello;
</script>

I started by creating a WebAPI controller and return a string through the Ok method. And end up with this:

clip_image001

This is not JavaScript and there for I can’t use it.

I found an article by Mike Wasson (http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/action-results). Where he creates a new IHttpActionResult.

With this new class. I can control the output. So it will be like this:

clip_image002

Tuesday, March 15, 2016

Remove all custom user action

On my current project I use the PnP framework provisioning to add custom user action to my web. The web gets quickly fell up the custom user action weird places and it is hard to see which of the custom user action is the latest and therefore the ones I should test. Therefore, I use this PowerShell snippet to delete all, before I re-run my provisioning.

$web = get-spweb https://apps.dev2.net/sites/dev1/
$customActionIds = $web.UserCustomActions | select id
$customActionIds | % {
  $web.UserCustomActions.Item($_.Id).Delete()
}

Monday, February 29, 2016

Office 365 Saturday update

With less than two weeks to Office 365 Saturday event, Saturday, March 12. And with a fully packed schedule on the latest trends for SharePoint, Azure Power BI, Power App, Governance and CRM. As well as with a good opportunity to network with both Danish and international persons. It will be an exciting day. Therefore, we are looking forward to seeing you We therefore look very much to see you. Tickets are still available and we suggest you to invite others in your network to join in on the day. There are still tricks back and therefore an invitation to invite others in your network to join in the day.

Read more about the event and register here http://spsevents.org/city/Copenhagen/Copenhagen2016/

Saturday, January 16, 2016

New event in the Danish SharePoint community Office 365 Saturday

A new event in the Danish SharePoint community has been posted on the user group website. Read more about SharePoint Bruger Gruppe (SPBG): Møder at http://ift.tt/1RWbLCQ