Archive

Archive for the ‘General’ Category

Add Links in SummaryLinksWebpart using PowerShell scripting

May 23rd, 2011 Comments off

More on the automation and adding data in other webparts. In previous post I talked about loading data in ContentEditorWebpart. Now look at SummaryLinkWebpart . Recently when i was working with SummaryLinkWebpart. I realised it is a bit different then other web parts to load links in summaryEditorWebpart. I looked for the internet but I couldn’t find any single example for SummaryLinksWebpart with power shell. So here is the example for others. I hope it will help some folks.

$webpart = new-object  $typeName
$webpartType = $webpart.GetType().ToString()

if($webpartType -eq “Microsoft.SharePoint.WebPartPages.ContentEditorWebPart”)
{
        if($values)
       {
               $keyValuePairs = $values.split(“,”)
               foreach ($keyValuePair in $keyValuePairs)
              {
                       $keyValueArray = $keyValuePair.Split(“|”)

                       [string]$propertyName = $keyValueArray[0].Trim()
                       [string]$propertyValue = $keyValueArray[1].Trim()

                       $sumLink = New-Object Microsoft.SharePoint.Publishing.SummaryLink $propertyName
                       $sumLink.LinkUrl = $propertyValue
                       $webpart.SummaryLinkValue.SummaryLinks.Add($sumLink)
                       $webpart.SummaryLinkValue = $webpart.SummaryLinkValue
              }
       }
}

Cheers

Load data in ContentEditorWebpart using PowerShell scripting

May 23rd, 2011 Comments off

If you are working on SharePoint content automation then powershell scripts are the most talked item. But sometime it is very difficult to find the right way to load data in web parts. For different web parts you have to treat differently. Here is the example to load data in ContentEditorWebpart.
I have a powershell function, where I’m passing some values including web part type and HtmlContent. HtmlContent is the text I want to set in ContentEditorWebpart.

$webpart = new-object  $typeName
$webpartType = $webpart.GetType().ToString()

if($webpartType -eq “Microsoft.SharePoint.WebPartPages.ContentEditorWebPart”)
{
        if($HtmlContent)
       {
              [string]$content = $HtmlContent.ToString()
              $docXml = New-Object System.Xml.XmlDocument
              $contentXml = $docXml.CreateElement(“Content”)
              $contentXml.set_InnerText($content)
              $docXml.AppendChild($contentXml)

              $webpart.Content = $contentXml
       }
}

I hope it will help.

Cheers

Recall message in Outlook 2007

October 1st, 2009 1 comment

Recall message is an amazing option in outlook. Sometime we click on send and then realized that we had missed something or had some mistake in message. In a few steps you can recall your message, isn’t it amazing and useful.

  •  Double click the sent message and open in new window.
  • Select Other Actions from Actions tab
  • Now choose Recall this message
    • Select Delete unread copies of this message.
      (Note: the recipient needs to have Outlook opened for the message to be deleted)
    • To replace the message:
    • Select Delete unread copies and replace with a new message, click OK, and type your new message.
    • To be notified about the success of the recall or replacement:
    • Check the Tell me if recall succeeds or fails for each recipient check box.
  • Click OK

Cheers

Categories: General Tags: ,