This post will contain some Windows 7 helpfull stuff
Links
- Link to Administrative Tools : shortcut:%systemroot%\system32\control.exe /name Microsoft.AdministrativeTools
The End
This post will contain some Windows 7 helpfull stuff
Links
The End
With one-level xml you can convert xml to csv in two lines of powershell:
Create file Stsadm-EnumSites.xml:
cmd > stsadm -o enumsites -url http://teams > Stsadm-EnumSites.xml
<Sites Count="2"> <Site Url="http://teams/" Owner="CONTOSO\XANDH" SecondaryOwner="CONTOSO\rinkr" ContentDatabase="WSS_Content_Teams" StorageUsedMB="0.6" StorageWarningMB="400" StorageMaxMB="500" /> <Site Url="http://teams/commercial/AALT" Owner="CONTOSO\ECPD" ContentDatabase="WSS_Content_Teams" StorageUsedMB="77.4" StorageWarningMB="400" StorageMaxMB="500" /> </Sites>
Your converter code:
#read from file [xml]$inputFile = Get-Content "Stsadm-EnumSites.xml" #export xml as csv $inputFile.Sites.ChildNodes | Export-Csv "Stsadm-EnumSites.csv" -NoTypeInformation -Delimiter:";" -Encoding:UTF8
Output: Stsadm-EnumSites.csv
"Url";"Owner";"SecondaryOwner";"ContentDatabase";"StorageUsedMB";"StorageWarningMB";"StorageMaxMB" "http://teams";"CONTOSO\XANDH";"CONTOSO\rinkr";"WSS_Content_Teams";"0.6";"400";"500" "http://teams/commercial/AALT";"CONTOSO\ECPD";;"WSS_Content_Teams";"77.4";"400";"500"
Cool :-)
This post is where I want to put how to do things from .NET in powershell.
There are some automatic conversions, for instance, that makes code different.
[char]$domsep = '\' [string]$userid = "CONTOSO\XANDH" #Split will in .NET accept a char[], but here it is OK to give the char directly without the array $userid = $userid.Split($domsep)[1] #XANDH # #In most cases you can use the powershell way to do split as below, but that does not work, when the split char is '\' #$userid = ($userid -split "\")[1] #XANDH #In case of split char is '\' you need to escape it with an extra '\' as follows: $userid = ($userid -split "\\")[1] #XANDH
if (-not [System.string]::IsNullOrEmpty($someString))
{
}
$crlf = "`n`r" $Body = "Testing CRLF:" + $crlf $Body += "Bla-bla"
In some cases a WSP is deployed to all WebApps. In other cases you can select which WebApps you will deploy the WSP to.
But what makes the difference?
When you in CentralAdmin goto System Settings – Manage Farm Solutions – Select a Wsp
If Contains Web Application Resource: Yes then it can be deployed to individual WebApps.
So how can you control this setting?
It seems to me that if you in Visual Studio goto Package.package – Manifest and see some line with <SafeControls> like
<SafeControls>
<SafeControl Assembly=”MyApp.Navigation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=de0229056b231800″ Namespace=”MyApp.Navigation” TypeName=”*” />
</SafeControls>
then the package will have a WebApp resource.
You can add SafeControls via Package.package - Advanced.
In a Sharepoint, where deveopment is in Visual Studio and deployment to ITest is via Wsp I have a solution structure like this:
- Solution:MyCom.MyWepApp
- Project:Common.ProjectForSeveralWebAppsWsp //A Wsp packaging project including code common to several webapps
- Project:MyWepApp.Wa.Layout //Some MyWepApp specific code
- Project:MyWepApp.Wa.WepParts //Some more MyWepApp specific code
- Project:MyWepApp.Wa.WepAppWsp //A Wsp packaging project for above two project
- Project:MyWepApp.Ca.CentralAdminWsp //A Wsp packaging project including some features for the CentralAdmin
There are three Wsp projects:
- One for deploy to MyWepApp (MyWepApp.Wa.WepAppWsp) and
- one for deploy to CentralAdmin (MyWepApp.Ca.CentralAdminWsp) and
- one for deploy to several dependant webapps (Common.ProjectForSeveralWebAppsWsp)
The MyWepApp.Wa.WepAppWsp project don’t include any code, but its Package.package includes the features and the dll’s for the projects above it.
For the MyWepApp.Wa.WepAppWsp project change the content of the .csproj file. You must unload the project before doing that.
You will find:
<Project> <!-- removed for clarity --> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\SharePointTools\Microsoft.VisualStudio.SharePoint.targets" /> </Project>
Replace above with:
<Project>
<!-- removed for clarity -->
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\SharePointTools\Microsoft.VisualStudio.SharePoint.targets" />
<PropertyGroup>
<PostBuildEventDependsOn>$(PostBuildEventDependsOn);CreatePackage</PostBuildEventDependsOn>
</PropertyGroup>
<PropertyGroup>
<!-- Copy package for WebApplication (created from the whole solution) -->
<PostBuildEvent>copy $(TargetDir)$(SolutionName).wsp $(SolutionDir)_Deployment\$(SolutionName)\Wa-Wsp\</PostBuildEvent>
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{BB1F664B-9266-4fd6-B973-E1E44974B511}">
<DeploymentConfigurations>
<DeploymentConfiguration Name="Attach only (MyCom)" Description="No deployment - only attach">
<DeploymentSteps>CKS.Dev.SharePoint.Deployment.AttachToIISWorkerProcesses;CKS.Dev.SharePoint.Deployment.AttachToSPUCWorkerProcess</DeploymentSteps>
</DeploymentConfiguration>
</DeploymentConfigurations>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
This will copy the wsp to a folder \_Deployment\ under the solution directory and put it in a subfolder created for WebApp deployment (\Wa-Wsp\) oppsed to a subfolder for CentralAdmin (\Ca-Wsp\) deployment.
For the Common.ProjectForSeveralWebAppsWsp project you could instead have like this:
<PropertyGroup>
<BuildDependsOn>$(BuildDependsOn);CreatePackage</BuildDependsOn>
</PropertyGroup>
<PropertyGroup>
<!-- Copy package for this project -->
<PostBuildEvent>copy $(TargetDir)$(TargetName)2010.wsp $(SolutionDir)_Deployment\$(TargetName)2010\$(TargetName)2010.wsp</PostBuildEvent>
</PropertyGroup>
Notice the DeploymentConfiguration. This you can add if you have CKSDev installed. Its purpose is to add a DeploymentConfiguration for the project, where you can attach to IIS without doing a full deployment. That part is usefull for those projects containing code for GAC/Bin
Some SGEN errors:
I you in Visual Studio get the error (while building release):
SGEN : error : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Then read about it here: http://hashtagfail.com/post/5255977780/sgen-loaderexceptions-error
and further about Fusion Log Viewer: http://www.hanselman.com/blog/BackToBasicsUsingFusionLogViewerToDebugObscureLoaderErrors.aspx
So how to access an OAuth protected resource (REST service) from a .NET webapplication in a generic manner?
Using WIF would be nice, since you would then just work just as if the OAuth protected REST service was an RP (and STS). In this case I think your app would be an active subject. But WIF does not implement OAuth.
But there are extensions for WIF. One can access OAuth through Azure Access Control Service (ACS) which then works as a bridge/gateway.
As far as I am aware ACS only provides access to OAuth 2.0 and not the older 1.0 protocol on which I believe Twitter is still using.
Here is a HowTo configure ACS to use Facebook as STS (FB uses OAuth 2.0).
But Azure is surely not free – I just don’t know what it costs.
Here is another sample - also bridging a WIF web app to OAuth/OpenID: http://southworks.github.com/protocol-bridge-claims-provider/.
It seems like that project is still only a sample.
If you just want to code towards OAuth without WIF, you can find samples like:
Twitter:
Yammer:
Create your own OAuth/OData service via ACS, WIF and EF: http://blogs.msdn.com/b/astoriateam/archive/2011/01/20/oauth-2-0-and-odata-protecting-an-odata-service-using-oauth-2-0.aspx
Links back from:
Import-Csv does not accept ANSI files.
Also semicolon delimiter needs to be specified.
$personsFilename = ".\persons.csv"
#Change encoding from ANSI to UTF-8 by reading and saving
#-Encoding:String # = ANSI = Windows-1252 = iso-8859-1
#print content on screeen
Get-Content $personsFilename -Encoding:String | ft
#convert to UTF-8. type is alias for Get-Content
type $personsFilename -Encoding:String | Out-File $personsFilename"UTF8.csv" -Encoding:UTF8
#Import-Csv by default accepts UTF-8
Import-Csv $personsFilename"UTF8.csv" -Delimiter:";" | Where-Object {$_.UserID -ieq "ABC"} | ft
Import-Csv $personsFilename"UTF8.csv" -Delimiter:";" | Where-Object {$_.UserID -ieq "ABC"} | Export-Csv $personsFilename"FilteredUTF8.csv" -NoTypeInformation -Delimiter:";" -Encoding:UTF8
$personsFile = Import-Csv $personsFilename"UTF8.csv" -Delimiter:";"
SQL Tip:
--do Accent Insentitive (AI) and Case Insentitive (CI) join select * from [TableA] a left outer join [TableB] b on a.[AID] COLLATE Latin1_general_CI_AI = b.[AID] COLLATE Latin1_general_CI_AI
Your old MOSS/WSS sln build using WSPBuilder can be converted to a SP2010 project using VS2010 Project template
Ongoing….
The old MOSS07 solutions uses WSPBuilder07
Strategy is to upgrade the MOSS07 solution to SP2010 using WSPBuilder10 for existing solutions.
New solutions should use the new SPI file layout
http://sharepoint.mindsharpblogs.com/Todd/archive/2010/08/24/Visual-Studio-2010-SharePoint-Project-SPIs.aspx. It replaced WSPBuilder.
Ports Required for Installation of Team Foundation Components
http://msdn.microsoft.com/en-us/library/dd578664.aspx
How to: Deploy an Application on a Virtual Environment
http://msdn.microsoft.com/en-us/library/ee471614.aspx
Build and Deploy Continuously
http://msdn.microsoft.com/en-us/library/ee308011.aspx
Understanding a Team Foundation Build System
http://msdn.microsoft.com/en-us/library/dd793166.aspx
Define a Build Using the Default Template
http://msdn.microsoft.com/en-us/library/dd647547.aspx#configs
Control Where the Build System Places Your Binaries
http://msdn.microsoft.com/en-us/library/ff977206.aspx
Team Foundation Build Activities – InvokeProcess
http://msdn.microsoft.com/en-us/library/gg265783.aspx#Activity_InvokeProcess
A couple of things to set for getting Remote Desktop access to a server for a domain user:
If you need Allow logon through Terminal Service, then there is a shortcut to add users on the server to the local group Remote Desktop Users:
Above requires Remote Desktop Users to have permission in:
Ensure that the user is not denied through
If you need Terminal Server User Access, then on the server go to:
There might be some local web sites that you want to access using Remote Desktop, but won’t let you authenticate with your valid password. It writes An account failed to log on (status: 0xc000006d, eventid: 4625) in the security eventlog.
This could be due to due to loopback check. The fix is to disable that check:
Links:
Content from Pattern & Practices – SP Guidance 2010:
Needed a sample of extension methods both in c# and VB.NET
Just for a nice reference…
Exchange 2010 Cmdlets http://technet.microsoft.com/en-us/library/bb124413.aspx
Test
Windows OS tools
Network tools
IIS Tools
Web/WebService
Using VirtualBox as hypervisor on a laptop eases usage of WLAN and USB on the guest OS.
This post is based on using VirtualBox 3.1.6 on Windows 7 (64 bit) with Windows 2008 R2 server, 64 bit, Standard edition.
Out of the box Windows 7 installed drivers for the WLAN in my laptop (with CPU i7 720) and for the full HD resolution video card. Nice.
Before trying out Sharepoint with MVC I’ve tried to think of what to expect:
Three points to think about when adding MVC to Sharepoint:
For inspecting HTML DOM and CSS there is IE Developer Toolbar for IE and Firebug for Firefox.
For inspecting HTML request and responses there is Fiddler for IE.
But Fiddler can also be used in Firefox with FiddlerHook:
Have also a look at a huge load of other Firebug extensions.
The end.

The End
While waiting for Visual Studio 2010 Ultimate RC to install I grapped images of what is being installed:
NET Web Services Security Nice to have links:
Misc. ASMX
The End.
Update: More Free Online Webinars!
http://www.criticalpathtraining.com/Schedule/Webcasts/Pages/default.aspx
Ranging Thursday, April 7, 2011 2p-3p EDT - Thursday, July 7, 2011 2p-3p EDT
Received an email with this Advertisement from Andrew Connell:
Have you ever experienced that you and another developer has a copy of the same VPC and wants to Check Out from TFS to the same path on each of your copy?
If yes, then you also know that TFS won’t allow this. I forgot what error it comes with.
You could change local path or computer name to get around this, but it might not be without trouble.
If you cannot change local path due to it might give you some extra trouble
and you don’t want to change the computer name – this can also cause trouble for SW like SharePoint – then:
Give each user each own virtual path to the C: drive.
There might be a ton of ways to put your WordPress postings out on other communities.
WordPress has a way it calls Publicize.
This function can publich to Facebook, Twitter an Yahoo.
The End.
Inspired by Thomas Martinsen, a dk Silverlight guru, this post collects a few ideas about the less used user interfaces in the PC world, but easily obtainable in the mobile world.
Having six devices to code towards in mind:
Many cell phones has all 6 pieces of HW included. So if you developed mobile services that could expose the HW facilities to a client PC (connected either through mini-USB, old fashioned serial, wlan or bluetooth), then you would get enormous application possiblities.
I blogged about Accelerometer, RFID and SMS usage before. At that post the accelerometer was a Wii NunChuck . Nowadays the accelerometer is build into the mobile phone and API’s has emerged.
WinMo 6.5 SDK was removed last month. Maybe WinMo 7 SDK is what Microsoft developers should have to get API’s for the 6 devices?
Thomas has spoken about touch screen development towards a device from Microsoft called Surface. I wouln’t be surprised if he is experienced in the field. Join the LinkeIn group.
Another keyword is Panel PC.
Currently I won’t collect more info, but I might return with an update to the post one day.
So for now you might just be inspired as well :-).
The End.
If something deserves blogging, patterns are one of those candidates, since they often needs explanation.
If the user miss the point he will easily end up as Patterns Happy.
Dependency Injection (DI) is an extended Factory pattern that enables dynamic configuration/plugin.
Links:
The End.
If you are a http://delicious.com user you might want to install the Sidebar
How do you register a .NET assembly for being callable from COM like from VB6?
Lets say you have a assembly called MyLib.dll.
Inside you have a namespace called MyNs.MyLib and a class called MyCls.
How to increase Exchange Management Shell (EMS) startup time from 35 sec to 5 sec:
powershell .\update-gac-exch.ps1 Already GACed: Microsoft.PowerShell.Commands.Management.dll Already GACed: Microsoft.PowerShell.Commands.Utility.dll Already GACed: Microsoft.PowerShell.ConsoleHost.dll Already GACed: Microsoft.PowerShell.Security.dll Already GACed: mscorlib.dll Already GACed: System.Configuration.Install.dll Already GACed: System.Data.dll Already GACed: System.DirectoryServices.dll Already GACed: System.dll Already GACed: System.Management.Automation.dll Already GACed: System.Management.dll Already GACed: System.Xml.dll
After doing that starting EMS should be much quicker.
Another link
The End.
If you want to try to pass a Microsoft exam, there is a new Second Shot offer:
http://www.microsoft.com/learning/Career/en/us/career-offer.aspx#certification
And for the wannabe masters there is a discount offer here:
http://www.microsoft.com/learning/en/us/certification/master.aspx#tab3
So how to remove CRLF from a select mycolumn from mytable?
Here is a Catch-All solution:
REPLACE(REPLACE(REPLACE(REPLACE(MyTable.MyColumn, CHAR(13) + CHAR(10), ' '), CHAR(10) + CHAR(13), ' '), CHAR(13), ' '), CHAR(10), ' ')
Thanx to Rex Tang.
But I just want to remove CRLF:
REPLACE(MyTable.MyColumn, CHAR(13) + CHAR(10), '')
Online learning material.
SP2010:
MOSS2007/WSS30:
Miscelaneous skills to study:
The end
Didn’t you meet up at Sharepoint Saturday EMEA?
Too bad – I still haven’t recovered fully yet.
Even though most of the presentations were in the SP2010 sign, some WSS30/MOSS2007 presentations could also blow you away.
One of them were KPI roll-up in SharePoint 2007 (WSS and MOSS) by Christophe Humbert. Get the Slides.
When you need to host several virtual machines (VM) in a PC, the CPU must support virtualization.
Good performance is reached, when there is a logical CPU and a Disk present for each VM.
In preparing for installing a developer environment with SharePoint2010 Beta I have collected a little info.
Everybody point to Jie Li as the expert.
But do also check out Setting Up the Development Environment for SharePoint Server.
64 bit OS and SW on top is required. If the 64 bit OS is not available you can use VMWare on a 32 bit OS to host 64 bit guest OS’s.
For a workstation (like Windows 7) a VMWare licence is not free. On a server, the licence is free.
I’ve been skimming the book 6 Microsoft Office Business Applications for Office SharePoint Server 2007.
There is an inspiring chapter about a CRM app, that uses outlook for forms generator and offline functionality. Sharepoint is used for workflow engine and doclib and MS CRM as backend.
Some slides from SalesOutlook CRM gives a little similar idea, but the book gives you the complete idea.
But the book Programming Microsoft Office Business Applications (Pro – Developer) even provides two online chapters:
More samples available on Office Business Applications Developer Center.
The late Patrick Tisseghem also has some nice OBA slides. His blog on the OBA subject contains several postings.
Finally there is the OBA homepage to explore.
Was looking for a Microsoft offer that could give OS’s and Servers to play with at home. Found a few interesting programs:
Just nice to know. About adding 3rd party dll’s to WSP packages.
VS2010:
And using WSPBuilder:
http://keutmann.blogspot.com/2009/08/wspbuilder-extensions-ver-106.html
I must admit that I am impressed.
Going to Win 2008 R2, Exchanserver 2010, Office 2010 and SharePint 2010 alltogether really makes a difference. I am usually not easy impressed.
I’ve attended Campus Days 2010 in CPH – DK. The program was designed for IT Pro’s, but had great first view tracks and a lab, where you could try it all out.
A datawash solution:
Problem: From Active Directory I had a long list, where column alias was not unique.
Instead of do any manual filtering away the aliases that were found more than once, I just wanted SQL server to throw away the duplets, leaving only one alias bin the list.
(more…)
I wanted to debug some .NET code from an oldfashioned ASP page. the ASP page called a COM enabled .NET component using Server.CreateObject().
The ASP page received a form posting before the call to the component.
If I replaced that serverside code with ASPX, then I instead could instanciate the .NET component through a “new MyNamespace.MyComponent()” instead of the “Server.CreateObject()”. By setting the posing ASP form as the startup url like http://mysite/myform.asp, I was then able to set a breakpoint in the new aspx page that received the form posting (myform_actions.aspx). The debugging could nicely continue in the .NET component.
When you do this trick of upgrading the code for the received form post, there is a few things to consider:
The migration worked fine and the debugging was a releave.
But initially I haven’t set the encoding.
When the form post entered the myform_actions.aspx I could see (using Fiddler) that a posted “ø” was sent correctly as “%F8″, but it was tranlated to “?”, when read from Request(“MyTextInputCtrl”).
There were some links telling me about the problem:
http://bytes.com/topic/asp-net/answers/491522-encoding-problem-when-posting-text-between-classic-asp-asp-net
http://www.w3.org/TR/html4/interact/forms.html#adef-accept-charset
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/gngrfGlobalizationSection.asp
The latter link fixed the problem:
<configuration> <system.web> <globalization requestEncoding="iso-8859-1" responseEncoding="iso-8859-1"/> </system.web> </configuration>
The accept-charset I did not use. It probably is not understood in a HTTP/1.0 post.
The End.
I was just told not to use
READ UNCOMMITTED also called dirty read in SQL 2008. A new possibilty exists:
READ COMMITTED SNAPSHOT
The problem with the first one is that if conn A reads a large bit, conn B do update, conn A reaches the updated bit and reads that, conn B rolls back, then conn A got illegal data.
If using the snapshot read, then conn A reads only on a snapshot as long as conn B is doing update. This snapshot contains the before transaction data.
This makes sence because had connection B just been a little later, then it would have been the same situation as with the snapshot option.
Thanks to Jesper Johansen
During a fault finding situation I ran into the problem where I wanted to replace the system account for the application pool for a WebApp.
(I got an “Service unavailable” error message when even the settings.aspx on the site was called, if I remember correct.)
I succeeded to create a new web application user manually by doing following:
But instead of doing it manually like in the example above you can just use Central Admin to create a new web application and use the user from step 1 above as app pool user. Then Central Admin does the rest for you :-) and you only have to change app pool user in step 5.
A little trick to create a OLEDB connection string:
Examples of generated connection strings:
Thanx to Rakesh Moturi
The End