Monday, 30 March 2009

Get first day of a given week number

Today, we run into a small question: How do I get the first day of a given week number? Well, we've had some troubles before with Microsofts date calculations (e.g. in MS Access). The problems occurred on the occassions when a year got 53 weeks. So we wrote some custom code to get a correct weeknumber.
Now the question is revert, we need the first day of the week, based on a weeknumber and a year. On the internet, there were some samples, but that were to much lines of codes.
So, this is a short version:


Private Function GetFirstDayOfTheWeek(year As integer, week As integer) As Date

Dim January4th As Date = DateSerial(year, 1, 4)
Dim January1th As Date = New Date(year), 1, 1)
Dim DayOfInterest As Date
Dim FirstDayWeek1 As Date

FirstDayWeek1 = January4th.AddDays(1).AddDays(-Weekday(January4th, FirstDayOfWeek.Monday))
DayOfInterest = January1th.AddDays(((week - 1) * 7 - DateDiff(DateInterval.DayOfYear, FirstDayWeek1, January1th, FirstDayOfWeek.Monday, FirstWeekOfYear.FirstFourDays)))

Return DayOfInterest

End Function

If you need some other date calculation routines, just let me know.

Read more...

Wednesday, 18 March 2009

Dynamically get an object from a form or report in Access

Today I was working on a private project in Access 2007. To fill some labels dynamically, I needed a function that searches in the control collection of a report to get my label of interest. Based on parameters I gave. As you may know, returning values from a function is in Access a bit old fashion, you cannot use 'return...'. It looks like this:


private function Test() as string
Dim strDemo as string
'Do something...
Test = strDemo
end function

Ok, that's fine. But I was looking for a dynamic way of filling some labels. So I needed to get that label from the report control collection to change the caption. This will not work using that 'FunctionName = ControlOfInterest' way. In the code below I show the way you can get your control of interest back using a function.

Private Function GetTargetLabel(i As Integer) As Label
Dim ctl As Control
Dim lblName As String

lblName = "lblVisitDate" & CStr(i)

For Each ctl In Me.Details.Controls
If ctl.ControlType = acLabel Then
If ctl.Name = lblName Then
Set GetTargetLabel = ctl
Exit For
End If
End If
Next
End Function

Note that you need to use the syntax 'Set FunctionName = ControlOfInterest'. Stupid, but that's the way it works. You can do the same trick for form controls as well.
You can customize this function dependent of your interest.
In an other function/sub I can just do the following:

GetTargetLabel(i).caption = "value of interest"

Read more...

Manage Internal NavigationNodes in Quick Launch

I build a little tool to move sites within a site collection. Moving sites works fine, but a bit strange that the link to the site is still present on the 'sites' heading on the quick launch bar of the parent site. So I decided to remove the link on the old parent site and create one on the new parent. Quite normal, not?
Well than I run into some troubles with adding links of subsites on the quick launch bar of the parent site.
I want to add the link under the 'sites' heading, so I found some code samples on the internet to do that. To add links to external sites is fine, Just create a new SPNavigationNode like this: with title, url and 'false'


Dim newNode as SPNavigationNode = _
New SPNavigationNode(webTitle, webUrl, False)

But for adding links on this way for subsites (which is actually an internal link) is slightly different. You don't need to add the full url, but that part of the url that's right behind the parent url.
So, if your subsite is http://intranet/project/demo, you need to enter only 'demo' (without the quotes of course).
So remeber, you need to get rid of the parent url part, because SharePoint will add that part just before your entered url. This will raise an error due to an invalid url.
My code will now look like this:

' NewParentWeb is an object of type SPWeb
Dim mySite As SPSite = New SPSite(NewParentWeb.Url)
Dim quickLaunchWeb As SPWeb = mySite.OpenWeb()
Dim quickLaunchNodes As SPNavigationNodeCollection = _
quickLaunchWeb.Navigation.QuickLaunch

' GetSitesNodeIndex is a function that returns the index of the 'sites'
' heading on the quick launch bar.
Dim sitesNodeIndex As Integer = GetSitesNodeIndex(quickLaunchWeb)

Dim navUrl As String = _
WebToMove.Url.Replace(NewParentWeb.Url & "/", "")
Dim newNode As SPNavigationNode = _
New SPNavigationNode(WebToMove.Title, navUrl, False)

quickLaunchNodes(sitesNodeIndex).Children.AddAsLast(newNode)

quickLaunchWeb.Update()

Edit:
Some of you asked for the GetSitesNodeIndex function. So I put it here.

Private Function GetSitesNodeIndex(ByVal web As SPWeb) As Integer

Dim i As Integer = 0
Dim nodes As SPNavigationNodeCollection = web.Navigation.QuickLaunch

For i = 0 To nodes.Count - 1
If nodes(i).Id = 1026 Then
Return i
End If
Next
Return Nothing
End Function

1026 is the node id of the site index. But you can also verify on the title property.

Read more...

Thursday, 12 March 2009

Why you don't want paste directly from Word to Blogger

Haha, today I thought to do something smart. I had a (short) line of text in my Word 2007 document (selected part),



and I was writing my previous post (Restore My Sites from different domain). So, just the copy - paste (from Word 2007 to Blogspot). Oops, I didn't went well (format messed up a bit :). So, I thought, well lets fix it at the 'Edit Html' tab. Woops, what's that? I saw a huge amount of code, just to show my short line of text. It places over more than 2,600 words containing almost 26,000!! characters. I reformatted this piece of code, just to share my experience with you.
I put it here:


<?xml version="1.0" encoding="utf-8" ?>
<ol>
<li>
<meta equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="ProgId" content="Word.Document">
<meta name="Generator" content="Microsoft Word 12">
<meta name="Originator" content="Microsoft Word 12">
<link rel="File-List"
href="file:///C:%5CDOCUME%7E1%5CROBVAN%7E1.000%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml">
<link rel="themeData"
href="file:///C:%5CDOCUME%7E1%5CROBVAN%7E1.000%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx">
<link rel="colorSchemeMapping"
href="file:///C:%5CDOCUME%7E1%5CROBVAN%7E1.000%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml">
<!--[if gte mso 9]>
<xml>
<w:worddocument>
<w:view>
Normal
</w:View>
<w:zoom>
0
</w:Zoom>
<w:trackmoves/>
<w:trackformatting/>
<w:punctuationkerning/>
<w:validateagainstschemas/>
<w:saveifxmlinvalid>
false
</w:SaveIfXMLInvalid>
<w:ignoremixedcontent>
false
</w:IgnoreMixedContent>
<w:alwaysshowplaceholdertext>
false
</w:AlwaysShowPlaceholderText>
<w:donotpromoteqf/>
<w:lidthemeother>
EN-US
</w:LidThemeOther>
<w:lidthemeasian>
X-NONE
</w:LidThemeAsian>
<w:lidthemecomplexscript>
X-NONE
</w:LidThemeComplexScript>
<w:compatibility>
<w:breakwrappedtables/>
<w:snaptogridincell/>
<w:wraptextwithpunct/>
<w:useasianbreakrules/>
<w:dontgrowautofit/>
<w:splitpgbreakandparamark/>
<w:dontvertaligncellwithsp/>
<w:dontbreakconstrainedforcedtables/>
<w:dontvertalignintxbx/>
<w:word11kerningpairs/>
<w:cachedcolbalance/>
</w:Compatibility>
<w:browserlevel>
MicrosoftInternetExplorer4
</w:BrowserLevel>
<m:mathpr>
<m:mathfont val="Cambria Math">
<m:brkbin val="before">
<m:brkbinsub val="--">
<m:smallfrac val="off">
<m:dispdef/>
<m:lmargin val="0">
<m:rmargin val="0">
<m:defjc val="centerGroup">
<m:wrapindent val="1440">
<m:intlim val="subSup">
<m:narylim val="undOvr">
</m:mathPr>
</w:WordDocument>
</xml>
<![endif]-->
<!--[if gte mso 9]>
<xml>
<w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267">
<w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal">
<w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1">
<w:lsdexception locked="false" priority="9" qformat="true" name="heading 2">
<w:lsdexception locked="false" priority="9" qformat="true" name="heading 3">
<w:lsdexception locked="false" priority="9" qformat="true" name="heading 4">
<w:lsdexception locked="false" priority="9" qformat="true" name="heading 5">
<w:lsdexception locked="false" priority="9" qformat="true" name="heading 6">
<w:lsdexception locked="false" priority="9" qformat="true" name="heading 7">
<w:lsdexception locked="false" priority="9" qformat="true" name="heading 8">
<w:lsdexception locked="false" priority="9" qformat="true" name="heading 9">
<w:lsdexception locked="false" priority="39" name="toc 1">
<w:lsdexception locked="false" priority="39" name="toc 2">
<w:lsdexception locked="false" priority="39" name="toc 3">
<w:lsdexception locked="false" priority="39" name="toc 4">
<w:lsdexception locked="false" priority="39" name="toc 5">
<w:lsdexception locked="false" priority="39" name="toc 6">
<w:lsdexception locked="false" priority="39" name="toc 7">
<w:lsdexception locked="false" priority="39" name="toc 8">
<w:lsdexception locked="false" priority="39" name="toc 9">
<w:lsdexception locked="false" priority="35" qformat="true" name="caption">
<w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title">
<w:lsdexception locked="false" priority="1" name="Default Paragraph Font">
<w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle">
<w:lsdexception locked="false" priority="22" semihidden="false" unhidewhenused="false" qformat="true" name="Strong">
<w:lsdexception locked="false" priority="20" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis">
<w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid">
<w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text">
<w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing">
<w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading">
<w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List">
<w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid">
<w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1">
<w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2">
<w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1">
<w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2">
<w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1">
<w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2">
<w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3">
<w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List">
<w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading">
<w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List">
<w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid">
<w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1">
<w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1">
<w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1">
<w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1">
<w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1">
<w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1">
<w:lsdexception locked="false" unhidewhenused="false" name="Revision">
<w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph">
<w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote">
<w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote">
<w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1">
<w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1">
<w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1">
<w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1">
<w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1">
<w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1">
<w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1">
<w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1">
<w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2">
<w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2">
<w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2">
<w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2">
<w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2">
<w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2">
<w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2">
<w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2">
<w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2">
<w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2">
<w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2">
<w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2">
<w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2">
<w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2">
<w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3">
<w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3">
<w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3">
<w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3">
<w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3">
<w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3">
<w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3">
<w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3">
<w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3">
<w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3">
<w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3">
<w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3">
<w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3">
<w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3">
<w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4">
<w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4">
<w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4">
<w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4">
<w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4">
<w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4">
<w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4">
<w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4">
<w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4">
<w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4">
<w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4">
<w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4">
<w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4">
<w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4">
<w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5">
<w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5">
<w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5">
<w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5">
<w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5">
<w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5">
<w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5">
<w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5">
<w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5">
<w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5">
<w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5">
<w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5">
<w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5">
<w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5">
<w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6">
<w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6">
<w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6">
<w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6">
<w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6">
<w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6">
<w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6">
<w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6">
<w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6">
<w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6">
<w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6">
<w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6">
<w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6">
<w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6">
<w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis">
<w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis">
<w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference">
<w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference">
<w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title">
<w:lsdexception locked="false" priority="37" name="Bibliography">
<w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading">
</w:LatentStyles>
</xml>
<![endif]-->
<style>
<!-- /* Font Definitions */
@font-face {
font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;
mso-font-charset:0;
mso-generic-font-family:roman;
mso-font-pitch:variable;
mso-font-signature:-1610611985 1107304683 0 0 159 0;
}
@font-face {
font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;
mso-font-charset:0;
mso-generic-font-family:swiss;
mso-font-pitch:variable;
mso-font-signature:-1593833729 1073750107 16 0 415 0;
}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal {
mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-parent:"";
margin-top:0cm;
margin-right:0cm;
margin-bottom:6.0pt;
margin-left:53.85pt;
text-align:justify;
mso-pagination:widow-orphan;
tab-stops:53.85pt;
font-size:9.0pt;
font-family:"Verdana","sans-serif";
mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";
mso-ansi-language:NL;
}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {
mso-style-update:auto;
mso-style-priority:34;
mso-style-unhide:no;
mso-style-qformat:yes;
margin-top:0cm;
margin-right:0cm;
margin-bottom:6.0pt;
margin-left:36.0pt;
mso-add-space:auto;
text-align:justify;
mso-pagination:widow-orphan;
tab-stops:53.85pt;
font-size:9.0pt;
font-family:"Verdana","sans-serif";
mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";
mso-ansi-language:NL;
}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst {
mso-style-update:auto;
mso-style-priority:34;
mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-type:export-only;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
mso-add-space:auto;
text-align:justify;
mso-pagination:widow-orphan;
tab-stops:53.85pt;
font-size:9.0pt;
font-family:"Verdana","sans-serif";
mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";
mso-ansi-language:NL;
}
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle {
mso-style-update:auto;
mso-style-priority:34;
mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-type:export-only;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
mso-add-space:auto;
text-align:justify;
mso-pagination:widow-orphan;
tab-stops:53.85pt;
font-size:9.0pt;
font-family:"Verdana","sans-serif";
mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";
mso-ansi-language:NL;
}
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast {
mso-style-update:auto;
mso-style-priority:34;
mso-style-unhide:no;
mso-style-qformat:yes;
mso-style-type:export-only;
margin-top:0cm;
margin-right:0cm;
margin-bottom:6.0pt;
margin-left:36.0pt;
mso-add-space:auto;
text-align:justify;
mso-pagination:widow-orphan;
tab-stops:53.85pt;
font-size:9.0pt;
font-family:"Verdana","sans-serif";
mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Times New Roman";
mso-ansi-language:NL;
}
.MsoChpDefault {
mso-style-type:export-only;
mso-default-props:yes;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;
mso-ansi-language:NL;
}
.MsoPapDefault {
mso-style-type:export-only;
margin-bottom:10.0pt;
line-height:115%;
}
@page Section1 {
size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;
mso-header-margin:36.0pt;
mso-footer-margin:36.0pt;
mso-paper-source:0;
}
div.Section1 {
page:Section1;
}
/* List Definitions */ @list l0 {
mso-list-id:1515269166;
mso-list-type:hybrid;
mso-list-template-ids:580178114 -1823804710 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;
}
@list l0:level1 {
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:71.85pt;
text-indent:-18.0pt;
}
@list l0:level2 {
mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:107.85pt;
text-indent:-18.0pt;
}
ol {
margin-bottom:0cm;
}
ul {
margin-bottom:0cm;
} -->
</style>
<!--[if gte mso 10]> <style> /* Style Definitions */
table.MsoNormalTable {
mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin-top:0cm;
mso-para-margin-right:0cm;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0cm;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-ansi-language:NL;
} </style> <![endif]-->
<p class="MsoListParagraph" style="margin-left: 71.85pt; text-indent: -18pt;">
<!--[if !supportLists]-->
<span style="">
<span style="">
1.<span ;
font-style: normal; font-variant: normal; font-weight: normal;
font-size: 7pt; line-height: normal; font-size-adjust:
none; font-stretch: normal;"> </span>
</span>
</span>
<!--[endif]-->
<span style="">
First of all, let the user create a My Site, in my example there will
be a site called: http://intranet/personal/brian_cox<o:p></o:p>
</span>
</p>
</li>
</ol>

So, just find the sentence: First of all, let the user create a My Site, in my example there will be a site called: http://intranet/personal/brian_cox :)

Read more...

Restore My Sites from different domain

After a major crash, we had to reinstall Active Directory. The SharePoint server was fine, but we were planning to reinstall it on a newer server, so we did that also.

So a crash of Active Directory (with problems to restore the backup) is really what’s called a ‘worst case scenario’. Because restoring the SharePoint backup isn’t that easy. Although the restore action, using the command line tool stsadm, is easy, you will run into security problems. Because SharePoint will not actually look to domain user names, but to the underlying GUID’s. And believe me, that’s not what you like to deal with. Anyway, I had to.

Restoring the credentials for almost all sites are successfully restored, took me a while, but seems to be fine now. But we are using also My Sites, and that’s a different story. If you are familiar with the Central Administration of SharePoint, you may know that each My Site is a different site collection. I tried different ways to restore the My Sites for the users, but failed. Today, I succeeded and I like to share it with you. You may deal with this problem too when migrating from one server farm to another or from one domain to another.

I have different backup files of the My Sites (with extension .dat). In this procedure I will illustrate the steps with the user Brian Cox. So I have a brian_cox.dat file, which is the backup of his My Site (which is a site collection in SharePoint).

  1. First of all, let the user create a My Site, in my example there will be a site called: http://intranet/personal/brian_cox
  2. Login on the SharePoint server (e.g. using RDC), and open the Central Administration
  3. The first thing we need to do, to add the SharePoint administrator account to be secondary administrator at the My Site of Brian Cox.
    1. Go to: Application Management > SharePoint Site Management > Site Collection Administrators
    2. Select the correct Site Collection you need to edit, in our example http://intranet/personal/brian_cox
    3. Now you need to add the administrator account you use for SharePoint administration issues as the secondary site collection administrator. You need to this to restore and overwrite the backup data to this personal site.


    4. Press OK when done.
  4. Now you are ready to restore the backup of Brian’s My Site.
    1. Start a command prompt and run the following statement:
      stsadm –o restore –url http://intranet/personal/brian_cox -filename c:\backup\brian_cox.dat -overwrite

    2. Wait till finished.
  5. Now you need to edit the site collection administrator (remember? The restore places also the site collection administrator back from the old domain, which is not recognized by this domain (guid issues)).
    1. Go to: Application Management > SharePoint Site Management > Site Collection Administrators.
    2. Select, again, the site collection http://intranet/personal/brian_cox. You will see something like this:

    3. Replace the primary site collection administrator back to Brian Cox and press ok.
  6. Mission accomplished!

Read more...

Wednesday, 4 March 2009

Windows Live Writer 2009 still sucks…

My previous experience with Windows Live Writer (beta) were not that good. It made a mess of tags. For example, it didn’t create new <p></p> when I started a new paragraph, but it did a kind of encapsulation like: <p><p>…</p></p>. So it messed the layout to much, showed to much white space and so on. So I actually didn’t like it.

Now this post is written from Windows Live Writer 2009, but it still sucks. It does still the strange things like I mentioned above.When I press enter (to start a new paragraph) it doesn’t show a new paragraph, but it encapsulate the whole text with another <p></p>.

Well, at least with my version of Blogger, it won’t work that well. It looks like a hard job to create a normal blog editor :(

Read more...

  © Blogger templates Psi by Ourblogtemplates.com 2008

Back to TOP