Trikks

The digital adventures of Eric Herlitz

Archive for the ‘Uncategorized’ Category

Enable SharePoint document conversions in PowerShell

Posted by trikks on February 8, 2013

Some of the document management features in SharePoint require certain features to be enabled. The most simple way to du such settings is by using PowerShell

Here is a snippet how to enable the DocumentConversions functionality

$app = Get-SPWebApplication http://enigma
$app.DocumentConversionsEnabled = 1
$app.Update()

Cheers

Posted in PowerShell, Sharepoint, SharePoint 2013, Uncategorized | Tagged: , , | Leave a Comment »

Error “Multiple management objects were found for identity” when enabling users in Lync

Posted by trikks on December 17, 2012

Having an error similar to this Enable-CsUser : Multiple management objects were found for identity “Håkan Karlsson”.?

In my case this occurred when having multiple AD’s that didn’t sync as they should and when moving a user around in my OU’s it got copied at one point instead of moved. In an AD with thousands of users this may become a bit problematic.

Solution 1 – find the duplicate user and remove it

Open PowerShell as admin and (this should be done at the AD server)

PS C:\> Import-Module ActiveDirectory
PS C:\> Get-ADUser -filter {(GivenName -eq "Håkan") -and (Surname -eq "Karlsson")}

This gave me

DistinguishedName : CN=Håkan Karlsson,OU=UnitName,OU=Customers,DC=domain,DC=se
Enabled           : True
GivenName         : Hakan
Name              : Håkan Karlsson
ObjectClass       : user
ObjectGUID        : 047cf709-0a3f-42f5-a459-b6885c99aace
SamAccountName    : hakan
SID               : S-1-5-21-54898309-311788698-4246315985-1142
Surname           : Karlsson
UserPrincipalName : hakan@domain.se
 
DistinguishedName : CN=Håkan Karlsson,OU=Sales,OtherUnit,OU=Customers,DC=domain,DC=se
Enabled           : True
GivenName         : Håkan
Name              : Håkan Karlsson
ObjectClass       : user
ObjectGUID        : 0bae8230-eb34-4119-bc97-bfde80a3dfe4
SamAccountName    : User13
SID               : S-1-5-21-54898309-311788698-4246315985-1265
Surname           : Karlsson
UserPrincipalName : User13@domain.se

There, it’s very easy to track and remove any of these users if I’d like to.

Solution 2 – Keep both users and add by DistinguishedName instead

Even though it’s rarely mentioned you can add users to Lync by their DistinguishedName.

Any given day you would type something like

Enable-CsUser -Identity "Håkan Karlsson" -RegistrarPool "lync.domain.se" -SipAddressType SamAccountName -SipDomain domain.se

Now, that was the command that didn’t work since you have two users by that name. Instead do this

Enable-CsUser –Identity "CN=Håkan Karlsson,OU=Sales,OtherUnit,OU=Customers,DC=domain,DC=se" 
-RegistrarPool "lync.domain.se" -SipAddressType SamAccountName -SipDomain domain.se

That’s it.

Lessons learned from this? Always use the DistinguishedName when adding users to lync!

Posted in Lync, PowerShell, Uncategorized | Tagged: , , | Leave a Comment »

Clean up your Umbraco Templates and Document Types

Posted by trikks on October 6, 2012

I run a couple of Umbraco sites and as usual after a couple of years some sites tend to become a bit dirty. The cleaning could be 100 % automated but thats to risky business for me but having some visual help in Template and Document Type usage was welcome. So by the help of uComponents uQuery I made some outputs.

Where you put the code is up to you, I did put it in an ascx file and run it as a macro.

Usings

using System;
using System.Collections.Generic;
using System.Linq;
using uComponents.Core;
using umbraco.cms.businesslogic.template;
using umbraco.cms.businesslogic.web;
using umbraco.interfaces;
using umbraco.NodeFactory;

The Code

/// <summary>
/// Invoke this method...
/// </summary>
private void WhatsUp()
{
    // Start at root level (-1) and populate the AllNodes property
    GetAllNodesAsFlatList(new Node(-1));
    PrintResultInfo("Templates", GetTemplateResult());
    PrintResultInfo("Document Types", GetDocTypeInfo());
}
 
/// <summary>
/// Return alias and occurences of all templates
/// </summary>
/// <returns></returns>
private List<Result> GetTemplateResult()
{
    return
        Template.GetAllAsList().Select(
            template =>
            new Result {Alias = template.Alias, Count = AllNodes.Count(x => x.template.Equals(template.Id))}).
            ToList();
}
 
/// <summary>
/// Return alias and occurences of all document types
/// </summary>
/// <returns></returns>
private List<Result> GetDocTypeInfo()
{
    return
        DocumentType.GetAllAsList().Select(
            documentType =>
            new Result() { Count = GetNodesByNodeType(documentType.Id), Alias = documentType.Alias }).ToList();
}
 
private int GetNodesByNodeType(int documentType)
{
    var nodes = uQuery.GetNodesByType(documentType);
    if (nodes == null)
        return 0;
 
    return nodes.Count;
}
 
/// <summary>
/// Print the result info
/// </summary>
/// <param name="header"></param>
/// <param name="results"></param>
private void PrintResultInfo(string header, List<Result> results)
{
    Response.Write(string.Format("<h1>{0}</h1>", header));
    Response.Write("<h2>Empty</h2>");
    foreach (Result result in results.Where(x => x.Count.Equals(0)))
    {
        Response.Write(string.Format("{0} [{1}]<br />", result.Alias, result.Count));
    }
 
    Response.Write("<h2>Used</h2>");
    foreach (Result result in results.Where(x => !x.Count.Equals(0)))
    {
        Response.Write(string.Format("{0} [{1}]<br />", result.Alias, result.Count));
    }
}
 
/// <summary>
/// Storage for GetAllNodesAsFlatList
/// </summary>
private readonly List<INode> AllNodes = new List<INode>();
 
/// <summary>
/// Get all child nodes from a certain node
/// </summary>
/// <param name="startNode"></param>
private void GetAllNodesAsFlatList(INode startNode)
{
    AllNodes.Add(startNode);
 
    // Traverse the above throug the node
    List<INode> children = startNode.ChildrenAsList;
    if (!children.Any())
        return;
 
    foreach (INode child in children)
    {
        GetAllNodesAsFlatList(child);
    }
}
 
/// <summary>
/// Result object
/// </summary>
private class Result
{
    public int Count { get; set; }
    public string Alias { get; set; }
}

The result

I did truncate the result to max 5 posts, the actual result was hundreds of lines :)
The result shows empty and used as groups with the alias and number of nodes that are using the Document Type or Template.

Thats it!
Cheers

Posted in Uncategorized | Leave a Comment »

Fix for broken bluetooth audio in Mac Os 10.6.5

Posted by trikks on November 17, 2010

Apple, you broke something. Now fix it! Until then, here’s how to do it yourself.

Updating to 10.6.5 brings a number of advantages and one big fail for those of us using bluetooth headsets or headphones, the audio simply breaks.

To fix it you need to downgrade a file (it’s actually a folder) called BluetoothAudioAgent.app located in /System/Library/CoreServices/, and here is how to do it.

Obtain an older version of the file BluetoothAudioAgent.app, it can be found on the installer dvd or on any of these links

Simply download and expand.

The nerdy version

  1. Obtain the file as stated above
  2. Disable bluetooth in system preferences
  3. Fire up a terminal and…
# Remove the broken version
$ sudo rm -rf /System/Library/CoreServices/BluetoothAudioAgent.app

# Copy the older version
$ sudo cp -r ~/Downloads/BluetoothAudioAgent.app /System/Library/CoreServices/

You are done, enable bluetooth again and enjoy working bluetooth audio!

 

The graphical version

Navigate to the right folder

Stuff placed in the CoreServices are considered as system utilities and you have to do some special moves. This can be done booth in the Finder and with the terminal. To navigate to the folder open a finder window and press CMD + SHIFT + G and paste the path

/System/Library/CoreServices/

Delete the misery file

Find the BluetoothAudioAgent and delete it, you have to turn off bluetooth in system preferences to be able to delete it.

Bring in the reinforcements

Now copy or move the downloaded version (2.3.3) to the same folder (/System/Library/CoreServices/). If you move it you have to authenticate, which is kind of a silly step since you have to state your password anyway when copying the file. It ain’t rocket science, just get the file there.

Thats it, you can now enjoy Bluetooth audio again!

Posted in Uncategorized | 6 Comments »

What about an ADO adapter for SharePoint (MOSS / WSS) Lists?

Posted by trikks on October 29, 2010

Microsoft Office SharePoint Server (MOSS) and Windows SharePoint Services (WSS) is quickly becoming a dominate application for storing and maintaining enterprise data and intelligence for organizations of all sizes. This has created a need and opportunity for people who has specialized in data integration and visualization between SharePoint and external applications. In MOSS 2007 there are a few options. You can use Web services to interact with SharePoint lists and other features or use the server object model to extend the capabilities. With MOSS 2010, Microsoft has stepped up by introducing the client object model, making it possible to use the object model remotely. Querying the underlying MOSS SQL server directly is highly unrecommended.

Unfortunately, many developers experience that the learning time to be able to rapidly develop applications working with MOSS/WSS is long. The developer often spend a lot of time understanding the MOSS/WSS data structure, naming conventions and data type conversion requirements. The developer also needs to understand the CAML (Collaborative Application Markup Language) syntax used to query lists and views. The code base tends to grow to a size that is not in proportion to the functionality.

So, whats the offer

Camelot .NET Connector for SharePoint is a ADO.NET driver for MOSS and WSS 2007/2010 which enables developers to query MOSS/WSS data using standard SQL language. The connector behaves like any other standard ADO.NET data provider by tranforming your queries to multiple operations sent to a MOSS/WSS Web service and returning the results using standard data types. SPC can be used by any developer with basic SQL knowledge. The following example shows how to create a Connection instance and run a UPDATE query on a list in MOSS/WSS through the Command instance.

Dim connection As New Camelot.SharePointConnector.Data.SharePointConnection("
    Server=mysharepointserver.com;
    User=spuser;
    Password=******;
    Authentication=Ntml;
    TimeOut=10;
    StrictMode=True;
    RecursiveMode=RecursiveAll;
    DefaultLimit=1000;
    CacheTimeout=5")

connection.Open()
Dim command As New Camelot.SharePointConnector.Data.SharePointCommand("UPDATE `mytable` SET `mycolumn` = 
'hello world'", connection)
command.ExecuteNonQuery()
connection.Close()

Is it free?

The connector requires a yearly subscription costing 1000€. The other products are free.

Free stuff

We offer a wide range of tools, some examples are

  • Joomla Integration
  • PHP toolkit to handle SharePoint data
  • Cool webparts like a MySQL dump tool for SharePoint lists
  • Query Browser
  • And more…

We are looking for testers

Test the full release for free. The testing periods are limited to a certain date. The current end date for any test version of Bendsoft software is 30th November 2010.

Apply at our website, http://www.bendsoft.com/

For more information you can contact us at info@bendsoft.com

Posted in Uncategorized | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.