Collaboration-2-Go


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

Support


Mobil: +49 (152) 53 97 78 79
Mail: service@collaboration-2-go.de
Weitere Kontaktmöglichkeiten: Kontaktseite
Dekoration: Köln



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:

DocLibPermissions

Documents with inherited permissions:

Documents with inherited permissions

Documents with individual permissions:

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

Post 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.
  
  
Button:
  
QR code promoted action
  
  
Modal Dialog:
  
QR Code
  
Let me know if you are interested.
    

Post 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
$folder.Update()
$web.Update()
  

    

Post 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.

  Ribbon
  
  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")
  

    

Post 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"
  }
}

    

Post 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)
    {
        $msg.To.Add($recipient)
    }

    if ($file -ne "")
    {
        $att = new-object Net.Mail.Attachment($file)
        $msg.Attachments.Add($att)
    }

    $smtpServer.Send($msg)

    if ($file -ne "")
    {
      $att.Dispose()
    }
}

$smtpServer = "my smtp server"
$file = "path to file"
$recipients = @( "user1@test.de", "user2@test.de" )
$sender = "sender@mydomain.com"
$subject = "My Subject"
$body = "My Mail Text"

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

    

Post 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)
      {
          try
          {
              $file = New-Object System.IO.FileInfo $Path
              [IO.File]::OpenWrite($file).close();
              $locked = $false
          }
          catch
          {
              # file is locked by a process.
              Start-Sleep -s 1000
          }
      }
      

    

Post 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:
      
      $analytics.Receivers.Count
      $pageRequests.Receivers.Count
      


      If the result is 0 you can re-enable the receivers
      (remove line breaks)
      
      if ($analytics.Receivers.Count -eq 0)
      {
        $analytics.Receivers.Add(
          "Microsoft.Office.Server.Search.Applications,
          Version=16.0.0.0, Culture=neutral,
          PublicKeyToken=71e9bce111e9429c",
          "Microsoft.Office.Server.Search.Analytics.Internal.
          AnalyticsCustomRequestUsageReceiver")
      }
      if ($analytics.EnableReceivers -eq $false)
      {
        $analytics.EnableReceivers = $true
        $analytics.Update()
      }

      if ($pageRequests.Receivers.Count -eq 0)
      {
        $pageRequests.Receivers.Add(
          "Microsoft.Office.Server.Search.Applications,
          Version=16.0.0.0, Culture=neutral,
          PublicKeyToken=71e9bce111e9429c",
          "Microsoft.Office.Server.Search.Analytics.Internal.
          ViewRequestUsageReceiver")
      }
      if ($pageRequests.EnableReceivers -eq $false)
      {
        $pageRequests.EnableReceivers = $true
        $pageRequests.Update()
      }
      

    

Post a Comment!


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

      Indent SharePoint Task using Nintex

      Ribbon

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

      Solution:
      - 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á

      Ribbon

      Web Service Call:

      Ribbon
      
      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>
        </Method>
      </Batch>
      

      
      Please replace SubItemID and ItemID by the corresponding
      workflow variables.
      
      Result:
      
      Ribbon
    

Post 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
      $file.SaveAs("c:\temp\MySolution.wsp")
      

    

Post 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")
      $job.Update()
      Restart-Service SPTimerV4

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

    

Post 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.

      Code:
      
      # enter valid values
      $url = "https://sharepoint.c2go.net/sites/test"
      $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]
      $impList.Views
      

    

Post 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.

Code:

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;
    ctx.Load(features);
    ctx.ExecuteQuery();
    features.Add(feature, true, FeatureDefinitionScope.None);
    ctx.ExecuteQuery();
}


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

Post 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.
    

Post 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("\\", $server.name)
  write-host "Performing IIS Reset on Server:"$server.name
  iisreset $server.Name

  write-host "Stopping SPTimerV4 on Server:"$server.name
  $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:"$server.name
  $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:"$server.name
}

    

Post 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 }

    

Post 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

HighlightRows.js:

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

function RenderColour(ctx) {
  var link = ctx.displayFormUrl +
    "&ID=" + ctx.CurrentItem.ID +
    "&source=" +
    encodeURIComponent(window.location.href);
  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) {
      row.style.backgroundColor = listItem.Colour;
    }
  }
  inCtx.skipNextAnimation = true;
}

    

Post 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.
  

Post 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'


Original:
Original


Result:
Result


(Additional menus: lock discussion, delete)
    

Post 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
$manager.Follow($actorInfo)

    

Post 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:

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

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

  if ($perssite -eq $null)
  {
    $profile.CreatePersonalSite(1031)

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

    

Post 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.
    

Post 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;#"

    

Post 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 = "https://mysite.collaboration-2-go.net"
      
# where to find users in the AD
$searchbase="DC=collaboration-2-go,DC=net"
      
# required if server domain and user domain are different
$dc="my_domain_controller"
      
# required if server language is English and
# MySite language is different
$culture = "de-DE"

$webapp = Get-SPWebApplication -identity $MySiteWebUrl
[System.Threading.Thread]::CurrentThread.CurrentUICulture =
  $culture
        
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
        $web.Update()
      }
          
      $web.Dispose()
    }
  }
        
  $site.Dispose()
}

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

Post 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
$web.Properties.update()

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

Post 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"

    

Post 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:
      
http://yourhost/_layouts/closeConnection.aspx?loginasanotheruser=true
      
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.
    

Post 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)
urls(1)="https://portal/sites/project1"
urls(2)="https://portal/sites/project2"
urls(3)="https://portal/sites/project3"

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

Dim PingReply
PingReply = "Reply from"

Dim TargetUrl
TargetUrl = "portal"

Dim outFile
outFile="c:\WarmUp\WarmUp2013.log"

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

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

'DeleteLog
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
    WarmUp()
  End If
Next

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
      WScript.Sleep(5000)
      Do while IE.readystate <> 4
      loop
    end if
  Next

  ie.Quit
  set ie = Nothing
end sub

sub DeleteLog()
  outFile="c:\svn\WarmUp2013.log"
  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
  objFile.Close
  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
    

Post 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
    

Post 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
    

Post 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).
      
      
      
      
    

Post 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
      HELO
      MAIL FROM: *sender smtp address*
      RCPT TO: *recipient smtp address*
      SUBJECT: *subject*
      DATA
      *your mail text*
      *empty line*
      

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

Post 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).
    

Post 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]
      


      Insert:
      
      BEGIN TRAN
        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
        begin
          set @currentMaxID = 0
        end
        set @newID = @currentMaxID + 1
        
        insert [dbo].[Orders]
        (OrderDate, CustomID, Title)
        values
        (getdate(), @newID, 'my title')
      COMMIT
      

      
      Recommendation: use the insert code within a stored procedure.
    

Post 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 PortalBLANKINTERNETCONTAINER#0
BlogBLOG#0
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
My Site HostSPSMSITEHOST#0
News SiteSPSNHOME#0
Collaboration PortalSPSPORTAL#0
Report CenterSPSREPORTCENTER#0
Enterprise Search CenterSRCHCEN#0
FAST Search CenterSRCHCENTERFAST#0
Basic Search CenterSRCHCENTERLITE#0
Team SiteSTS#0
Blank SiteSTS#1
Document WorkspaceSTS#2
Visio Process RepositoryVISPRUS#0
Wiki SiteWIKI#0

      

  

Post 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:
      
      try
      {
        // Create new Session
        Outlook.Application outApp = new Microsoft.Office.Interop.
          Outlook.Application();
        Outlook.NameSpace ns = outApp.GetNamespace("MAPI");
        ns.Logon(Type.Missing, Type.Missing, false, true);

        // Change Context
        Outlook.Recipient organizer = ns.CreateRecipient(
          "shared@collaboration-2-go.de");
        organizer.Resolve();

        // Open Shared Calendar
        Outlook.MAPIFolder folder = ns.GetSharedDefaultFolder(
          organizer,
          Microsoft.Office.Interop.Outlook.OlDefaultFolders.
          olFolderCalendar);

        // Create Meeting Request in Shared Folder
        Outlook._AppointmentItem mr =
          (Outlook._AppointmentItem)folder.Items.Add(
          Microsoft.Office.Interop.Outlook.
          OlItemType.olAppointmentItem);
        mr.MeetingStatus = Microsoft.Office.Interop.Outlook.
          OlMeetingStatus.olMeeting;
        mr.Location = "my location";
        Outlook.Recipient recipient = mr.Recipients.Add(
          "user@collaboration-2-go.de");
        recipient.Resolve();
        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;

        mr.Save();
        mr.Send();
      }
      catch (Exception ex)
      {
        System.Diagnostics.Debug.WriteLine(ex.ToString());
      }
      

    

Post 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
    

Post 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
    

Post 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:
      
      ?Contents=1
      

      For example:
      
      http://collaboration/SitePages/Homepage.aspx?Contents=1
      

    

Post 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.
      
      Start:
      
      net start MSSQLSERVER
      net start SQLWriter
      net start IISADMIN
      net start W3SVC
      net start SPTraceV4
      net start OSearch14
      net start SPAdminV4
      net start SPTimerV4
      


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

    

Post a Comment!


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

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

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

    

Post 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
        begin
          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
        end

      close db_cursor
      deallocate db_cursor
      

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

Post 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.
      
      Elements.xml:
      
      <?xml version="1.0" encoding="utf-8"?>
      <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <HideCustomAction
          Id="HideDeleteSPWeb"
          GroupId="SiteTasks"
          HideActionId="DeleteWeb"
          Location="Microsoft.SharePoint.SiteSettings">
        </HideCustomAction>
      </Elements>
      

      If you use MOSS2007 you have to replace
        GroupId="SiteTasks"
      by
        GroupId="SiteAdministration"
    

Post 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.
    

Post 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
    

Post 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.
    

Post 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
        begin
          set @filename = @basepath + @filedate + '-' + @dbname + '.bak'
          print @filename
          backup database @dbname to disk = @filename with compression
          fetch next from db_cursor into @dbname
        end

        close db_cursor
      deallocate db_cursor

      

      Ensure folder permissions for your service account!
    

Post 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
    

Post a Comment!


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

      SharePoint 15 Technical Preview Managed Object Model SDK released
    

Post 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
    

Post 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).
    

Post 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)…
    

Post 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
    

Post 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" />
      </asp:DropDownList>
      

      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.
    

Post 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/litwareinc.com/Public 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
      }
      else
      {
        New-PublicFolder -Name $NewFolder
      }

      # Use ADO to change the folder type
      $o=New-Object -comobject ADODB.Record
      $updated=$false
      $timeout=60
      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
          "http://schemas.microsoft.com/exchange/outlookfolderclass")
        {
          $updated=$true
          $item.Value="IPF.Appointment"
        }
      }

      $o.Fields.Update()
      $o.Close()

      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
    

Post 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
    

Post a Comment!


Media Player for Web Pages
Created: 02.10.2011
Categories: Website

      Yahoo! Media Player: http://mediaplayer.yahoo.com
      Some Style Samples: http://www.ponticstar.com/blog/2009/12/12/hacking-yahoo-media-player/

      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="http://mediaplayer.yahoo.com/js" >
      </script>
      <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;
      }
      

    

Post a Comment!


Collaboration-2-Go.de is Live
Created: 01.10.2011
Categories: Collaboration-2-Go

      Collaboration-2-Go.de is live.
      
      Collaboration-2-Go.eu, Collaboration-2-Go.com, C-2-Go.de and
      C-2-G.de 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.
    

Post a Comment!