Lösungen und Software-Entwicklung im Collaboration Umfeld, insbesondere Microsoft SharePoint, Microsoft Exchange und Microsoft Office.


Mobil: +49 (152) 53 97 78 79
Weitere Kontaktmöglichkeiten: Kontaktseite
Dekoration: Köln

Query OpenAI's ChatGPT
Created: 18.01.2023
Categories: Open AI

Query OpenAI's ChatGPT and get an answer by sending a completion request.

Very simple example:

// add using
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Text;
using System.Text.Json;

// add necessary variables
string endpoint = "{model}/completions";
// model:
// text-davinci-003: data until Jun 2021, most capable model
// text-curie-001: data until Oct 2019, very capable model
// text-babbage-001: data until Oct 2019, capable of straightforward tasks
// text-ada-001: data until Oct 2019, capable of very simple tasks
// Note: request changes with the model, this sample uses text-davinci-003
string model = "text-davinci-003";
string key = "get_your_own"; //
int temp = 0;
int maxTokens = 2048;
string question = "What is ChatGPT?";
string answer;

// add function call
    answer = queryOpenAI(question, endpoint, model, key, temp, maxTokens);
catch (Exception ex)
    // your error handling


// query function
public string queryOpenAI(string question, string endpoint, string model, string key, int temp, int maxTokens)
    System.Net.ServicePointManager.SecurityProtocol =
        System.Net.SecurityProtocolType.Tls12 |
        System.Net.SecurityProtocolType.Tls11 |

    // build request
    string endpointUrl = endpoint.Replace("{model}", model);
    var request = WebRequest.Create(endpointUrl);
    request.Method = "POST";
    request.ContentType = "application/json";
    request.Headers.Add("content-type", "application/json");
    request.Headers.Add("Authorization", "Bearer " + key);

    //  create data for request
    var sb = new StringBuilder();
    sb.Append(" \"model\":\"" + model + "\",");
    sb.Append(" \"prompt\": \"" + encodeQuotes(question) + "\",");
    sb.Append(" \"max_tokens\": " + maxTokens + ",");
    sb.Append(" \"temperature\": " + temp);
    string data = sb.ToString();

    // send request
    using (var streamWriter = new StreamWriter(request.GetRequestStream()))

    // get response
    var response = request.GetResponse();
    var streamReader = new StreamReader(response.GetResponseStream());
    string json = streamReader.ReadToEnd();
    var oair = JsonSerializer.Deserialize(json);

    // return result
    return oair.choices[0].text;

// get quotes
private string encodeQuotes(string s)
    if (s.IndexOf("\\") != -1)
        s = s.Replace("\\", @"\\");

    if (s.IndexOf("\n\r") != -1)
        s = s.Replace("\n\r", @"\n");

    if (s.IndexOf("\r") != -1)
        s = s.Replace("\r", @"\r");

    if (s.IndexOf("\n") != -1)
        s = s.Replace("\n", @"\n");

    if (s.IndexOf("\t") != -1)
        s = s.Replace("\t", @"\t");

    if (s.IndexOf("\"") != -1)
        return s.Replace("\"", @"""");
        return s;

// Helper classes generated by
public class OpenAIResponse
    public string id { get; set; }
    public string @object { get; set; }
    public int created { get; set; }
    public string model { get; set; }
    public List choices { get; set; }
    public Usage usage { get; set; }

public class Choice
    public string text { get; set; }
    public int index { get; set; }
    public object logprobs { get; set; }
    public string finish_reason { get; set; }

public class Usage
    public int prompt_tokens { get; set; }
    public int completion_tokens { get; set; }
    public int total_tokens { get; set; }

Further Reading:
- API Reference
- Keys / Registration
- Models
- Tokens
- JSON - C# Class Generator


Send us a Comment!

Nintex - Resolve SharePoint and Active Directory Groups
Created: 22.11.2020
Categories: SharePoint 2016; SharePoint 2019; Nintex

In order to retrieve all members in aSharePoint group (including AD groups) you must follow these steps:
- get members of the SharePoint group using a SharePoint web service; result in an XML
- collect information about these group members
Resolve SharePoint and Active Directory Groups

Web Service call using UserGroup.asmx:
Resolve SharePoint and Active Directory Groups

3 tasks which evaluate the XML result using these XPath values:

Resolve SharePoint and Active Directory Groups

Resolve SharePoint and Active Directory Groups

Test result (for each item):
- get login name
- get information wether item is a active directory domain group (IsDomainGroup):

Resolve SharePoint and Active Directory Groups

Resolve SharePoint and Active Directory Groups

Resolve SharePoint and Active Directory Groups

Resolve SharePoint and Active Directory Groups

Switch: if item is a group start a LDAP query.

Resolve SharePoint and Active Directory Groups

Preparation (get login name only):

Resolve SharePoint and Active Directory Groups

LDAP query:

Resolve SharePoint and Active Directory Groups

LDAP query Value:

Recursive LDAP query Value:
(you have to get the distinguished name first)

Resolve SharePoint and Active Directory Groups

Resolve SharePoint and Active Directory Groups


Resolve SharePoint and Active Directory Groups

Resolve SharePoint and Active Directory Groups

Resolve SharePoint and Active Directory Groups

Send us a Comment!

Fun with JavaScript and SharePoint: View Item Permissions
Created: 01.03.2020
Categories: SharePoint 2016; SharePoint 2019; SharePoint Online/Office365; SharePoint Development; JavaScript

Without any doubts individual permissions for documents and list items are a bad idea. But sometimes it is necessary. In SharePoint those individual permissions are hard to manage. With this extension you can see the permissions in the standard view.

Document Library:


Documents with inherited permissions:

Documents with inherited permissions

Documents with individual permissions:

Documents with individual permissions
Let me know if you are interested.

Send us a Comment!

Fun with JavaScript and SharePoint: QR Code
Created: 01.03.2020
Categories: SharePoint 2016; SharePoint 2019; SharePoint Online/Office365; SharePoint Development; JavaScript

Add a QR code to each SharePoint page using a JavaScript. If the user clicks on the button, a modal dialog pops up that shows the current url as a QR code.
QR code promoted action
Modal Dialog:
QR Code
Let me know if you are interested.

Send us a Comment!

Export und Import SPWeb with Workflows
Created: 13.11.2018
Categories: PowerShell; SharePoint Development; SharePoint 2016

      If you want to export and import a SharePoint site you can use Export-SPWeb and Import-SPWeb. In most cases these commands work fine.
  If you have SharePoint Designer Workflows in this site, SharePoint adds a folder called "Workflows" and sometime this folder has a property
  called "docid_msft_hier_listid_validate" and a value which is invalid during the import.
  German error message:
  Import-SPWeb : Von der Zeichenfolge dargestellte DateTime liegt außerhalb des gültigen Bereichs.
  The following command changes the value and an import can be executed without problems:

$web = Get-SPWeb -Identity https://sharepoint/sites/PowerShellTests
$folder = $web.Folders["Workflows"]
$property = $folder.Properties["docid_msft_hier_listid_validate"]

$dt = Get-Date -Year 2100 -Month 12 -Day 31
$folder.Properties["docid_msft_hier_listid_validate"] = $dt


Send us a Comment!

Rename Internal Document Library Name
Created: 10.11.2018
Categories: PowerShell; SharePoint Development; SharePoint 2016

      If you want to rename a SharePoint library you can use the library configuration.
  If you want to rename the internal name you could use SharePoint Designer. Unless you have more than 5.000 items (which is a bad idea anyway):
  Server error: The attempted operation is prohibited because it exceeds the list view treshold enforced by the administrator.

  But you can change the internal name using PowerShell:
    $url = "https://sharepoint/sites/PowerShellTests"
    $web = Get-SPWeb $url
    $lib = $web.GetList($web.Url + "/oldName")
    $rootFolder = $lib.RootFolder
    $rootFolder.MoveTo($web.Url + "/newName")


Send us a Comment!

Re-Apply Quotas
Created: 05.10.2017
Categories: PowerShell; SharePoint Development; SharePoint 2016

      If you change a quota template you have to re-apply the template. In this case it was very easy since all sites have the same quota (personal My Sites).

$wa = $get-spwebapplication "my site host url"
$wa.Sites | foreach-object {
  if ( $_.Url.StartsWith("my site host url/personal") ) {
    Set-SPSite -Identity $_.Url -QuotaTemplate "Personal Site"


Send us a Comment!

Send Mail
Created: 04.10.2017
Categories: PowerShell

      If you want to send a mail with an attachment using PowerShell you can you this code:

function SendSmtpMail($server, $sender, $recipients, $subject, $body, $file)
    $msg = new-object Net.Mail.MailMessage
    $smtpServer = new-object Net.Mail.SmtpClient($server)
    $msg.From = $sender
    $msg.Subject = $subject
    $msg.Body = $body

    foreach ($recipient in $recipients)

    if ($file -ne "")
        $att = new-object Net.Mail.Attachment($file)


    if ($file -ne "")

$smtpServer = "my smtp server"
$file = "path to file"
$recipients = @( "", "" )
$sender = ""
$subject = "My Subject"
$body = "My Mail Text"

SendSmtpMail $smtpServer $sender $recipients $subject $body $file


Send us a Comment!

Check if File is Locked
Created: 20.09.2017
Categories: PowerShell

      If you want to check if a file is locked you can you this snippet:

      $locked = $true
      while ($locked)
              $file = New-Object System.IO.FileInfo $Path
              $locked = $false
              # file is locked by a process.
              Start-Sleep -s 1000


Send us a Comment!

Empty Popularity Trends and Most Popular Items
Created: 24.08.2017
Categories: SharePoint Development; PowerShell; SharePoint 2016

      In case the popularity trends report and the most popular items report are empty you can check (and re-eanble) the event receivers using PowerShell:

      Get receivers:
      $analytics = Get-SPUsageDefinition | where {
        $_.Name -like "Analytics*" }
      $pageRequests = Get-SPUsageDefinition | where {
        $_.Name -like "Page Requests" }

      Check receivers:

      If the result is 0 you can re-enable the receivers
      (remove line breaks)
      if ($analytics.Receivers.Count -eq 0)
          Version=, Culture=neutral,
      if ($analytics.EnableReceivers -eq $false)
        $analytics.EnableReceivers = $true

      if ($pageRequests.Receivers.Count -eq 0)
          Version=, Culture=neutral,
      if ($pageRequests.EnableReceivers -eq $false)
        $pageRequests.EnableReceivers = $true


Send us a Comment!

Indent SharePoint Task using Nintex
Created: 09.08.2017
Categories: SharePoint 2016; Nintex

      Indent SharePoint Task using Nintex


      Nintex doesn't provide the appropriate field
      in order to indent a task below another task.

      - Create Nintex Workflow (in this sample: in the task list)
      - Remember current item ID in a variable
      - Create task within this Workflow
      - Remember new item ID in a variable
      - Wait a while
      - Call WebService in order to update new item
      - Voilá


      Web Service Call:

      Web Service XML:
      <Batch OnError="Continue" PreCalc="TRUE" ListVersion="0">
        <Method ID="1" Cmd="Update">
          <Field Name="ID">SubItemID</Field>
          <Field Name="ParentID">ItemID</Field>

      Please replace SubItemID and ItemID by the corresponding
      workflow variables.

Send us a Comment!

Download WSP Solution File from SharePoint
Created: 26.04.2017
Categories: SharePoint Development; PowerShell

      Download WSP Solution File from SharePoint

      $farm = Get-SPFarm
      $file = $farm.Solutions.Item("MySolution.wsp").SolutionFile


Send us a Comment!

Activate SharePoint TimerJob using PowerShell
Created: 20.02.2017
Categories: SharePoint Development; PowerShell

      Activate SharePoint TimerJob using PowerShell

      # Configuration
      $app = Get-SPWebapplication "web app url"
      $jobname = "my job name"
      $siteurl = "site url will be used within the job"

      # Install
      $job = New-Object MyNamespace.MyClass(
        $jobname, $app, $siteurl)
      $job.Schedule = [Microsoft.SharePoint.SPSchedule]::
        FromString("daily between 01:00:00 and 01:00:00")
      Restart-Service SPTimerV4

      # Check
      (Get-SPTimerJob | where-object{$_.Name -eq $jobname)}) | fl


Send us a Comment!

Access Personal Views / Do something on behalf
Created: 04.01.2016
Categories: SharePoint Development; PowerShell

      Impersonate and access personal views of somebody else.

      # enter valid values
      $url = ""
      $listName = "MyListName"
      $login = "MyLogin"

      $web = Get-SPWeb $url
      $userid = ($web.Allusers | where-object
        { $_.LoginName -eq $login }).ID
      $user = $web.AllUsers.GetByID($userid)
      $token = $user.UserToken;
      $impSite = New-Object Microsoft.SharePoint.SPSite
        ($web.Url, $token);
      $impWeb = $impSite.OpenWeb()
      $impList = $impWeb.Lists[$listName]


Send us a Comment!

Activate Feature using CSOM
Created: 19.04.2015
Categories: SharePoint 2013; SharePoint Development

Add references to Microsoft.SharePoint.Client and Microsoft.SharePoint.Client.Runtime.


string url = "https://sharepoint/sites/teamsite";
string domain = "myDomain";
string login = "myLogin";
string pwd = "myPassword";
// feature id for MySite Newsfeed webpart:
Guid feature = new Guid("6928B0E5-5707-46a1-AE16-D6E52522D52B");

using (var ctx = new ClientContext(url))
    ctx.AuthenticationMode = ClientAuthenticationMode.Default;
    ctx.Credentials =
      new System.Net.NetworkCredential(login, pwd, domain);
    var features = ctx.Site.Features;
    features.Add(feature, true, FeatureDefinitionScope.None);

This way you I'm able to activate hidden features or start a bulk activation.

Send us a Comment!

Upload Document to a SharePoint Library
Created: 15.03.2015
Categories: PowerShell; SharePoint 2013

Upload Document to a SharePoint Library:

$destinationUrl = "https://sharepoint/sites/teamsite/documents"
$file = get-childitem "e:\tmp\document.txt"

$webclient = New-Object System.Net.WebClient
$webclient.UseDefaultCredentials = $true
$webclient.UploadFile($destinationUrl + "/" + $file.Name, "PUT", $file.FullName)

In case you don't want to use integrated security you have to set the credentials.

Send us a Comment!

Restart Worker Processes and SPTimerV4 in Farm
Created: 13.12.2014
Categories: PowerShell; SharePoint 2013

Restart IIS worker processes and SPTimerV4 in SharePoint Farm

add-pssnapin microsoft.sharepoint.powershell
$spserver = get-spserver | ?{$_.role -eq "Application"}
foreach ($server in $spserver)
  $name = [string]::concat("\\", $
  write-host "Performing IIS Reset on Server:"$
  iisreset $server.Name

  write-host "Stopping SPTimerV4 on Server:"$
  $stat = sc.exe $name stop sptimerv4
  $stat = sc.exe $name query sptimerv4
  while ($stat -match "STOP_PENDING")
    write-host "Stopping"
    $stat = sc.exe $name query sptimerv4
    start-sleep 4

  write-host "Starting SPTimerV4 on Server:"$
  $stat = sc.exe $name start sptimerv4
  $stat = sc.exe $name query sptimerv4
  while (-not $stat -match "RUNNING")
    write-host "Starting"
    $stat = sc.exe $name query sptimerv4
    start-sleep 4

  write-host "SPTimerV4 started on Server:"$


Send us a Comment!

Remove duplicate Active Directory Group Memberships
Created: 10.12.2014
Categories: PowerShell

Once I had to remove all users in an Active Directory group in case they are also member of a second group.

# if I have to talk to a different but truested domain
$dc = "my_domain_controller"

# my groups
$group1 = "my_first_group"
$group2 = "my_second_group"

diff (Get-ADGroupMember -Identity $group1 -Server $dc) (Get-ADGroupMember -Identity $group2 -Server $dc) -Property 'distinguishedName' -IncludeEqual | ?{ $_.sideIndicator -eq "==" } | foreach-object { write-host $_.distinguishedName ; Remove-ADGroupMember -Identity $group1 -Server $dc -Members $_.distinguishedName -Confirm:$false }


Send us a Comment!

SharePoint Lists and Coloured Rows
Created: 26.08.2014
Categories: SharePoint 2013; SharePoint Development

If you want to use coloured rows in SharePoint lists,

  • copy code to a file called 'HighlightRows.js'

  • Remove spaces in RenderColour between '< and a' and '< and img'
  • (stupid blog software)

  • upload file to a site collection and remember the path

  • add calculated column called 'Colour' to your list

  • Provide colour in this field, e.g. =IF(Priority="High";"rgba(255, 0,0,0.5)";IF(Priority ="medium";"rgba(255, 255,0,0.5)";"#ffffff"))

  • Include colour field in all views

  • Bind all views to JS in the ListView webpart settings, e.g. to ~sitecollection/style%20library/HighlightRows.js

Coloured SharePoint list


(function () {
  var overrideCtx = {};
  overrideCtx.Templates = {};
  overrideCtx.OnPostRender = [ HighlightRowOverride ];
  overrideCtx.Templates.Fields={ "Colour":{"View":RenderColour}}

function RenderColour(ctx) {
  var link = ctx.displayFormUrl +
    "&ID=" + ctx.CurrentItem.ID +
    "&source=" +
  var text = "< a class='ms-core-suiteLink-a' href='" +
    link +
    "'>< img src='/_layouts/15/images/icgen.gif'>";
  return text;

function HighlightRowOverride(inCtx) {
  for (var i = 0; i < inCtx.ListData.Row.length; ++i) {
    var listItem = inCtx.ListData.Row[i];
    var iid = GenerateIIDForListItem(inCtx, listItem);
    var row = document.getElementById(iid);
    if (row != null) { = listItem.Colour;
  inCtx.skipNextAnimation = true;


Send us a Comment!

SharePoint and Remote Blob Storage - Performance Considerations
Created: 14.02.2014
Categories: SharePoint 2013

In our SharePoint 2013 test farm we installed RBS. Unfortunately the performance is very bad. We used an RBS system from a different manufacturer than Microsoft.

Average download times for a 14 MB video file and a 1 MB Word document:
File SizeFile stored in SQL ServerFile stored in RBS
14 MB4,06 sec30,3 sec
1 MB0,79 sec2,8 sec

This is pretty bad. Is seems that the performance regression is related to the new Shredded Storage setting. If we increase the setting up to 1 GB we get the following results:
File SizeFile stored in SQL ServerFile stored in RBSAdjusted Shredded Storage
14 MB4,06 sec30,3 sec3,44 sec
1 MB0,79 sec2,8 sec0,77 sec

The manufactorer was surprised in the first discussion but confirmed the results later. He told us that we have to disable the shredded storage.
Here you can see the results in Visual Studio:
Measuring native SQL Server
Measuring RBS
Measuring RBS with disabled shredded storage
First tests with native RBS coming with SQL Server 2012 don't show this downshift. Maybe we will follow this path.

Send us a Comment!

Newsfeed Administrator - Lock and delete Newsfeed Posts
Created: 21.01.2014
Categories: SharePoint 2013

Newsfeed Administrator - Lock and delete Newsfeed Posts:
  • Open Central Admin
  • Open Application  Management
  • Click next to "User Profile Service" without changing the page but highlighting the service

    User Profile Service
  • Click button "Administrators" in ribbon

    Click on button 'Administrators'
  • Add user
  • Check permission "Manage Social Data"
    Check 'Manage Social Data'



(Additional menus: lock discussion, delete)

Send us a Comment!

Add Followers to a SharePoint 2013 Site
Created: 11.01.2014
Categories: SharePoint 2013; SharePoint Development; PowerShell

Add Followers to a SharePoint 2013 Site using PowerShell:

$followedSite = „https://sharepoint/sites/news“
$loginName = „roloff“

$profile = $upm.GetUserProfile($loginName)
$manager = New-Object Microsoft.Office.Server.Social.SPSocialFollowingManager($profile)

$actorInfo = New-Object Microsoft.Office.Server.Social.SPSocialActorInfo
$actorInfo.ContentUri = $followedSite
$actorInfo.ActorType = 2 # SPSocialActorType.Site


Send us a Comment!

Create SharePoint 2013 MySites
Created: 10.01.2014
Categories: SharePoint 2013; SharePoint Development; PowerShell

Create SP2013 MySites using an AD group and PowerShell:

$adGroup = ""  # AD Group with MySite users
$siteURL = ""  # any local SharePoint Site will do

$members = Get-ADGroupMember -Identity $adgroup -Recursive | sort name

# get UserProfileManager
$serviceContext  = Get-SPServiceContext -site $siteURL -ErrorAction Stop
$upm = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext) -ErrorAction Stop

foreach ($member in $members)
if ($upm.UserExists($member.SamAccountName))
  $profile = $upm.GetUserProfile($member.SamAccountName)
  $perssite = $profile.PersonalSite

  if ($perssite -eq $null)
    # either this
    $profile.CreatePersonalSite(1031)  # should work in most cases
    # or this
    # $profile.CreatePersonalSiteEnque($true)  # will work in all cases; gets language from mysite host

    $perssite = $profile.PersonalSite
    if ($perssite -eq $null)
      # do some error handling


Send us a Comment!

SharePoint Database Size
Created: 09.01.2014
Categories: SharePoint 2013; SharePoint Development; PowerShell

SharePoint Database Size using PowerShell:

Get-SPDatabase |
  where-object { $_.TypeName -eq "Content Database" } |
  select Displayname,
  @{Name="Mbytes";Expression={$_.DiskSizeRequired/ 1Mb}}

Please note: TypeName is localized, e.g. use "Inhaltsdatenbank" in a German farm.

Send us a Comment!

Multiple Default Values for a Choice Column
Created: 26.11.2013
Categories: SharePoint 2013

In order to define multiple default values for a choice column just use a calculated default value:

=";#choice 1;#choice 2;#choice 3;#"


Send us a Comment!

Rename SharePoint MySite Blog
Created: 16.11.2013
Categories: SharePoint 2013; SharePoint Development; PowerShell

Want to rename your MySite blogs using PowerShell since all MySite blog names are "Blog"?

# URL to your MySite web application
$MySiteWebUrl = ""
# where to find users in the AD
# required if server domain and user domain are different
# required if server language is English and
# MySite language is different
$culture = "de-DE"

$webapp = Get-SPWebApplication -identity $MySiteWebUrl
[System.Threading.Thread]::CurrentThread.CurrentUICulture =
foreach ($site in $webapp.Sites)
  # Get Active Directory Information
  $login = $site.Owner.LoginName
  if ($login.contains("\"))
    $login = $login.substring($login.indexof("\") + 1)
  $ldapfilter = "(SamAccountName=" + $login + ")"
  $aduser = Get-ADUser -LDAPFilter $ldapfilter
    -SearchBase $searchbase -Server $dc
  $displayName = $aduser.GivenName + " " + $aduser.Surname
  if ($displayName -eq " ")
    $displayName = $site.owner.DisplayName
  if ($site.RootWeb.WebTemplate -eq "SPSPERS") # ignore MySite host
    # more sophisticated approach is possible but
    # I'm not sure about the blog URL
    foreach ($web in $site.AllWebs)
      if (($web.WebTemplate -eq "BLOG") -and
        ($web.Title -eq "Blog"))
        $title = "Blog von " + $displayName
        $web.Title = $title

If you don't set the culture SharePoint changes to English title only.

Send us a Comment!

SharePoint Blog Layout
Created: 16.11.2013
Categories: SharePoint 2013; SharePoint Development; PowerShell

Want to apply different blog layouts using PowerShell?
Sample: Standard Layout:
Blog Beitrag Layout Standard

Sample: Framed Layout:
Blog Beitrag Layout Umrahmt

$web = Get-SPWeb https://sharepoint/sites/blog
write-host $web.Properties["ms-blogs-skinid"]
$web.Properties["ms-blogs-skinid"] = 1

Valid values for ms-blogs-skinid: 1, 2, 3

Send us a Comment!

Collecting ULS Data
Created: 29.07.2013
Categories: SharePoint 2010; SharePoint 2013

Samples for collecting ULS data from all servers:

Collect all data:
Merge-SPLogFile -Path C:\tmp\FarmLog.log

Collect all data with a correleation ID (remove line break):
Merge-SPLogFile -Path C:\tmp\FarmLog.log
  -Correlation b572479c-ce57-10ce-c901-ce456a0284dc

Collect all data within a timeframe (adjust regional time format, remove line break):
Merge-SPLogFile -Path C:\tmp\FarmLog.log
  -StartTime "28.07.2013 00:00" -EndTime "28.07.2013 23:59"


Send us a Comment!

Login as a different User
Created: 23.07.2013
Categories: SharePoint 2013

If you want to use the SP2010 functionality 'Login as a different User'
you can use the following link:
There is no need to adjust the Welcome.ascx as suggested in many blogs.
Please remember that other client applications (e.g. Word) are not aware of this different
login but provide their own authentication.

Send us a Comment!

SharePoint Warm-Up
Created: 19.07.2013
Categories: SharePoint 2010; SharePoint 2013

If you want to start your SharePoint web applications you can use the following
VisualBasic script as a warm-up for SharePoint. The code copies the host file
in order to reach each web front end server.
server1: "host-server1"
server2: "host-server2"
Plus "host-original" in order to move back
VBS Code:

' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' URL List

Dim urls(3)

Dim servers(2)
servers(1) = "server1"
servers(2) = "server2"

Dim PingReply
PingReply = "Reply from"

Dim TargetUrl
TargetUrl = "portal"

Dim outFile

' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'On error resume next

' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Code
dim fso
dim startTime
startTime = Now

AddToLog "------------------------------------------------"

set fso = CreateObject("Scripting.FileSystemObject")

For Each server in servers
  If server <> "" Then
    AddToLog "---------------- " & UCase(server)
    hostfile = "C:\Windows\System32\drivers\etc\hosts-" & server
    fso.CopyFile hostfile, "C:\Windows\System32\drivers\etc\hosts"
    PingResult TargetUrl
  End If

AddToLog "---------------- RESET"
fso.CopyFile "C:\Windows\System32\drivers\etc\hosts-original", "C:\Windows\System32\drivers\etc\hosts"
PingResult TargetUrl
set fso = Nothing

AddToLog "---------------- Summary"
minTime = UBound(urls) * UBound(servers) * 5
duration = datediff("s", startTime, now)
AddToLog "URLs: " & UBound(urls)
AddToLog "Minimal Time: " & minTime
AddToLog "Duration (s): " & duration
If duration > (minTime + 5) Then
  AddToLog "Warning!"
End If
AddToLog "------------------------------------------------"

' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Subs

sub WarmUp()
  dim ie
  set ie = CreateObject("InternetExplorer.Application")
  ie.Visible = 0

  For Each u1 In urls
    if u1 <> "" then
      AddToLog u1
      ie.Navigate2 u1
      Do while IE.readystate <> 4
    end if

  set ie = Nothing
end sub

sub DeleteLog()
  Set objFSOFile=CreateObject("Scripting.FileSystemObject")
  objFSOFile.DeleteFile outFile
end sub

sub AddToLog(txt)
  set objFSOFile=CreateObject("Scripting.FileSystemObject")
  set objFile = objFSOFile.OpenTextFile(outFile, 8, True)
  objFile.Write Now & " - " & txt & vbCrLf
  wscript.echo txt
end sub

sub PingResult(host)
  dim objShell
  dim objExec
  set objShell = CreateObject("WScript.Shell")
  set objExec = objShell.Exec("ping -n 1 -w 1000 " & host)
  pr = objExec.StdOut.ReadAll
  pr = mid(pr, InStr(pr, PingReply))
  pr = left(pr, InStr(pr, ":") - 1)
  AddToLog pr
  set objShell = Nothing
  set objExec = Nothing
end sub

You can use the script as a scheduled task. Use an account that has read access in the sites.

Alternative: Use IIS8 setting "AlwaysRunning" instead.
Not tested yet but this sounds promising: Post by Trevor Seward

Send us a Comment!

Find your Worker Process
Created: 12.05.2013
Categories: Visual Studio; SharePoint Development

Find your worker process that hosts your SharePoint web application:
c:\Windows\System32\inetsrv\appcmd.exe list wp
Worker Process

Send us a Comment!

Site Archivar for SharePoint
Created: 10.05.2013
Categories: Collaboration-2-Go; SharePoint 2010; SharePoint 2013

Our third product is ready to buy: Site Archivar for SharePoint

Site Archivar for SharePoint

Site Archivar for SharePoint

Site Archivar for SharePoint

Send us a Comment!

Site Compass listed at SharePointPlus
Created: 11.01.2013
Categories: Collaboration-2-Go

      Both our Site Compass for SharePoint and the Contact WebPart are listed at SharePointPlus.
      See also our solution pages (German).

Send us a Comment!

Send SMTP Mail using Telnet
Created: 03.01.2013
Categories: Exchange

      Send SMTP Mail using Telnet

      Start telnet and enter the following text:
      open *smtp-server* 25
      MAIL FROM: *sender smtp address*
      RCPT TO: *recipient smtp address*
      SUBJECT: *subject*
      *your mail text*
      *empty line*

      Replace the text surrounded by asterisk.
      Quit telnet by entering 'bye'.

Send us a Comment!

Site Compass listed at Microsoft PinPoint
Created: 02.01.2013
Categories: Collaboration-2-Go

      Collaboration-2-Go and our Site Compass for SharePoint are listed at PinPoint.
      See also our page (German).

Send us a Comment!

SQL Server - Sequential IDs for each month
Created: 30.11.2012
Categories: SQL Server

      Sequential IDs for each month and each month begins with an ID=1
      Sample Table:
      CREATE TABLE [dbo].[Orders](
      [ID] [int] IDENTITY(1,1) NOT NULL,
      [OrderDate] [date] NOT NULL,
      [CustomID] [int] NOT NULL,
      [Title] [nchar](50) NOT NULL
      ) ON [PRIMARY]

        declare @currentMaxID int
        declare @newID int

        select @currentMaxID = max(CustomID)
        from [dbo].[Orders] WITH (UPDLOCK)
        where year(OrderDate) = year(getdate())
        and month(OrderDate) = month(getdate())

        if @currentMaxID is null
          set @currentMaxID = 0
        set @newID = @currentMaxID + 1
        insert [dbo].[Orders]
        (OrderDate, CustomID, Title)
        (getdate(), @newID, 'my title')

      Recommendation: use the insert code within a stored procedure.

Send us a Comment!

SharePoint Site Template IDs
Created: 12.11.2012
Categories: SharePoint Development

      SharePoint Site Template IDs, e.g. for stapling features:
Template NameTemplate ID
Assets Web DatabaseACCSRV#1
Charitable Contributions Web DatabaseACCSRV#3
Contacts Web DatabaseACCSRV#41
Projects Web DatabaseACCSRV#5
Issues Web DatabaseACCSRV#6
Document CenterBDR#0
Business Intelligence CenterBICenterSite#0
Publishing Site with WorkflowBLANKINTERNET#2
Publishing SiteCMSPUBLISHING#0
Enterprise WikiENTERWIKI#0
Basic Meeting WorkspaceMPS#0
Blank Meeting WorkspaceMPS#1
Decision Meeting WorkspaceMPS#2
Social Meeting WorkspaceMPS#3
Multipage Meeting WorkspaceMPS#4
Records CenterOFFILE#1
Group Work SiteSGS#0
Site DirectorySPSITES#0
Personalization SiteSPSMSITE#0
Collaboration PortalSPSPORTAL#0
Enterprise Search CenterSRCHCEN#0
Basic Search CenterSRCHCENTERLITE#0
Team SiteSTS#0
Blank SiteSTS#1
Document WorkspaceSTS#2
Visio Process RepositoryVISPRUS#0
Wiki SiteWIKI#0



Send us a Comment!

Send Meeting Request Using a Shared Mailbox in Outlook Add-In
Created: 02.11.2012
Categories: Exchange Development; Outlook Development

      Change user context in Outlook add-in and send meeting request using a shared mailbox:
        // Create new Session
        Outlook.Application outApp = new Microsoft.Office.Interop.
        Outlook.NameSpace ns = outApp.GetNamespace("MAPI");
        ns.Logon(Type.Missing, Type.Missing, false, true);

        // Change Context
        Outlook.Recipient organizer = ns.CreateRecipient(

        // Open Shared Calendar
        Outlook.MAPIFolder folder = ns.GetSharedDefaultFolder(

        // Create Meeting Request in Shared Folder
        Outlook._AppointmentItem mr =
        mr.MeetingStatus = Microsoft.Office.Interop.Outlook.
        mr.Location = "my location";
        Outlook.Recipient recipient = mr.Recipients.Add(
        recipient.Type = (int)Outlook.OlMeetingRecipientType.olRequired;
        mr.Subject = "my subject";
        mr.Start = DateTime.Now.AddHours(1);
        mr.Duration = 60;
        mr.Body = "my meeting request";
        mr.ReminderMinutesBeforeStart = 15;
        mr.ReminderSet = true;

      catch (Exception ex)


Send us a Comment!

Site Compass Light WebPart for SharePoint
Created: 25.10.2012
Categories: Collaboration-2-Go; SharePoint 2010

      Our second product is ready to buy: Site Compass Light Webart for SharePoint

      Site Compass Webart for SharePoint

Send us a Comment!

End of Windows Phone App Tatort Planer
Created: 23.10.2012
Categories: Windows Phone; Collaboration-2-Go

      Due to the disappointment of the sales of my Windows Phone App "Tatort Planer" I
      decided to remove it from the marketplace. Too much work, expenses for developer
      registration too high, no gain at all (Microsoft keeps income less than ~200 €).

      Anyway, I will try to update the data for some weeks.
      Thank you for your support, ideas and help.

      Tatort Planer Sales

Send us a Comment!

SharePoint Webpart Maintenance Page
Created: 15.10.2012
Categories: SharePoint 2007; SharePoint 2010

      In order to remove webparts from malfunctioning pages just add the following part to the URL:

      For example:


Send us a Comment!

Start and Stop SQL Server and SharePoint Services
Created: 06.10.2012
Categories: SharePoint 2010

      Start and stop SQL Server and SharePoint services e.g. on development machines.
      net start MSSQLSERVER
      net start SQLWriter
      net start IISADMIN
      net start W3SVC
      net start SPTraceV4
      net start OSearch14
      net start SPAdminV4
      net start SPTimerV4

      net stop SPTraceV4
      net stop OSearch14
      net stop SPAdminV4
      net stop SPTimerV4
      net stop MSSQLSERVER
      net stop SQLWriter
      net stop IISADMIN
      net stop W3SVC


Send us a Comment!

SharePoint CAML Query for Lookup Fields
Created: 27.09.2012
Categories: SharePoint 2010; SharePoint Development

      CAML query for a lookup field:
          <FieldRef Name='Name' />
          <Value Type='Lookup'>Smith</Value>

      CAML query for a lookup field using the ID:
          <FieldRef Name='Name' LookupId='True' />
          <Value Type='Lookup'>7</Value>


Send us a Comment!

Shrink all Databases
Created: 10.09.2012
Categories: SQL Server

      If you want to shrink all your databases including logs you can use the following script:
      declare @dbname sysname
      declare @sql nvarchar(1000)

      declare db_cursor cursor for
      select name from master.dbo.sysdatabases
      where name not in ('tempdb', 'model', 'msdb', 'master')
      open db_cursor

        fetch next from db_cursor into @dbname
        while @@fetch_status = 0
          print @dbname
          select @sql = '
          ALTER DATABASE [' + @dbname + '] SET RECOVERY SIMPLE
          DBCC SHRINKDATABASE ([' + @dbname + '])
          ALTER DATABASE [' + @dbname + '] SET RECOVERY FULL'
          exec sp_executesql @sql
          fetch next from db_cursor into @dbname

      close db_cursor
      deallocate db_cursor

      Caution: do not use the script in productive databases since you lose
      the logs for your current backup.

Send us a Comment!

Hide 'Delete Website' Link
Created: 07.09.2012
Categories: SharePoint Development

      If you want to hide the 'Delete Website' link you can use the following elements in a feature.
      <?xml version="1.0" encoding="utf-8"?>
      <Elements xmlns="">

      If you use MOSS2007 you have to replace

Send us a Comment!

SQL Server Access as a local Administrator
Created: 03.09.2012
Categories: SQL Server

      In case you have lost your passwords for all your SQL Server accounts here
      is a way that works in SQL Server 2008 R2 to get access:
      1.) Write a batch file:
        sqlcmd -Q "CREATE LOGIN [domain\user] from windows"
        sqlcmd -Q "EXEC sys.sp_addsrvrolemember
           @loginame = N'domain\user', @rolename = N'sysadmin'"

      2.) Replace values for domain\user as appropriate, remove linebreak in 2nd sqlcmd
      3.) Add this Script to your scheduled tasks
      4.) Run scheduled task as SYSTEM
      5.) Wait and see

      It shouldn't work in SQL Server 2012 anymore.

Send us a Comment!

Site Contact WebPart for SharePoint
Created: 02.09.2012
Categories: Collaboration-2-Go; SharePoint 2010

      Our first product is ready to buy: Site Contact Webart for SharePoint

      Site Contact WebPart for SharePoint

Send us a Comment!

SQL Server - Get Active Connections
Created: 16.05.2012
Categories: SQL Server

      Get active connections using the following script:
        select * from sys.sysprocesses where dbid = DB_ID('WSS_Content')

      In case you want to end an connection you can kill der connection using the id.

Send us a Comment!

SQL Server - Backup all Databases except System Databases
Created: 19.03.2012
Categories: SQL Server

      Backup all databases except system databases using the
      following script:
      declare @dbname sysname
      declare @basepath sysname
      declare @filename sysname
      declare @filedate varchar(8)

      set @basepath = 'c:\Backup\'
      select @filedate = convert(varchar(8), getdate(), 112)

      declare db_cursor  cursor for
      select name from master.dbo.sysdatabases
      where name not in ('tempdb', 'model', 'msdb', 'master')
        open db_cursor
        fetch next from db_cursor into @dbname

        while @@fetch_status = 0
          set @filename = @basepath + @filedate + '-' + @dbname + '.bak'
          print @filename
          backup database @dbname to disk = @filename with compression
          fetch next from db_cursor into @dbname

        close db_cursor
      deallocate db_cursor


      Ensure folder permissions for your service account!

Send us a Comment!

Windows Phone Tatort Planer
Created: 14.03.2012
Categories: Windows Phone; Collaboration-2-Go

      Windows Phone Tatort Planer is available at Microsoft Marketplace.
      Thinking about a version for iPad and iPhone...
      Windows Phone Tatort Planer

Send us a Comment!

SharePoint 15 Technical Preview SDK
Created: 02.02.2012
Categories: SharePoint Development

      SharePoint 15 Technical Preview Managed Object Model SDK released

Send us a Comment!

Collaboration-2-Go and SharePoint Plus
Created: 24.11.2011
Categories: Collaboration-2-Go

      In near future Collaboration-2-Go will sell several products and services @ SharePoint Plus.

      Sharepoint Plus Logo

Send us a Comment!

Workshop for SharePoint Developers finalized
Created: 23.11.2011
Categories: Collaboration-2-Go; SharePoint Development

      Workshop for SharePoint Developers is finished. Find the agenda for 4-5 days here
      (German agenda only).

Send us a Comment!

SharePoint Field Definitions require Braces
Created: 10.10.2011
Categories: SharePoint Development; SharePoint 2010

      SharePoint Field definitions in Elements.xml require braces, e.g.
      Field ID="{9D6556BF-D5AC-41B7-94BA-56ABE77CEDC8}"

      Otherwise you get the following error message:
      Unable to locate the xml-definition for FieldName with FieldId '9D6556BF-D5AC-41B7-94BA-56ABE77CEDC8', exception: Microsoft.SharePoint.SPException ---> System.Runtime.InteropServices.COMException (0x8000FFFF): 0x8000ffff     at Microsoft.SharePoint.Library.SPRequestInternalClass.GetGlobalContentTypeXml(String bstrUrl, Int32 type, UInt32 lcid, Object varIdBytes)…

Send us a Comment!

Visual Studio: Trust a Path Location
Created: 07.10.2011
Categories: Visual Studio

      Visual Studio doesn't trust network paths and annoys developers with notifications. In case you want to keep the messages but you also want to trust a specific share you can use CASPOL:
      caspol -m -ag 1.2 -url file:\\z:\MyPath FullTrust

Send us a Comment!

There is no Attribute AccessKey in Select Boxes
Created: 05.10.2011
Categories: Website

      When I use the following code with Doctype "XHTML 1.0 Strict"
      <asp:DropDownList runat="server" ID="ddl" AccessKey="1">
      <asp:ListItem Text="item1" />
      <asp:ListItem Text="item2" />

      I get the following error from lovely W3C Validation Service:
      Line 135, Column 93: there is no attribute "accesskey"
      …ame="ctl00$MainContent$ddlTitle" id="ctl00_MainContent_ddl" accesskey="1">

      Unfortunately this is correct.

Send us a Comment!

How to create Exchange Public Folders for Appointments
Created: 04.10.2011
Categories: Exchange Development; Exchange; PowerShell

      Unfortunately the PowerShell cmdlet New-PublicFolder doesn’t allow different types for public folders. But with a small trick you can set the type later. The code requires CDOEX that runs locally only.

      PowerShell Code:
      $FolderPath = "/TEMP"
      $NewFolder = "CalendarTest"
      $PFRoot = "file://./backofficestorage/ Folders"

      # Use PowerShell cmdlet to create new folder
      # (depending upon whether a root folder or not)
      if ($FolderPath -ne "")
        $f = $FolderPath -replace("/", "\")
        New-PublicFolder -Name $NewFolder -Path $f
        New-PublicFolder -Name $NewFolder

      # Use ADO to change the folder type
      $o=New-Object -comobject ADODB.Record
      while (($updated -eq $false) -and ($timeout -gt 0))
        $o.Open($PFRoot + $FolderPath + "/" +
         $NewFolder, "", 3, -1, -1, "", "")
        foreach($item in $o.Fields)
        if($item.Name -eq


      if ($updated -eq $false)
      Start-Sleep -s 1
      $timeout --

      Tested IPF Types: IPF.Post, IPF.Contact, IPF.Appointment, IPF.Task
      Tested Exchange Version: Exchange 2007

Send us a Comment!

Access Keys in different Browsers
Created: 02.10.2011
Categories: Website

      Access Keys in different Browsers:
      Internet Explorer: Alt+Key
      Chrome: Alt+Key
      Safari: Alt+Key
      Firefox: Alt+Shift+Key
      Opera: Alt+Esc: Menu

Send us a Comment!

Media Player for Web Pages
Created: 02.10.2011
Categories: Website

      Yahoo! Media Player:
      Some Style Samples:

      Successfully tested with Internet Explorer 8+9, Firefox Firefox 5+6, 5, Safari 5.1, Opera 11.50 (all on Win7)
      Doesn't work with Google Chrome 13 on Win7, Safari on iPad (iOS 4)

      Code in HTML:
      <script type="text/javascript" src="" >
      <a href="mymusicfile.mp3" >My Music</a>

      Applied Styles:
      /* Hide player */
      #ymp-player, #ymp-tray, #ymp-error-bubble, #ymp-secret-bubble
      display: none !important;
      /* Hide Buttons */
      a.ymp-btn-page-play, a.ymp-btn-page-pause
      margin-left: -20px !important;
      a.ymp-btn-page-play em.ymp-skin, a.ymp-btn-page-pause em.ymp-skin
      display: none !important;


Send us a Comment! is Live
Created: 01.10.2011
Categories: Collaboration-2-Go is live.
   ,, and as well.

      Services can be provided as described.
      Products will be developed in near future.

      Please contact us on any question or remark you have.

Send us a Comment!