Wednesday, December 18, 2013

Feringghi Garden Restaurant, Penang - Christmas Decorations

There are some seriously awesome decorations this year! Let the photos do all of the talking.
  LED reindeers.

 Back entrance.


Thursday, December 12, 2013

Christmas decorations at Queensbay Mall Penang

As we countdown to Christmas here is another random post on Chrismas decorations :P

It's a candy wonderland this year.

Even the trees are full of lollipops.

Wednesday, December 11, 2013

SharePoint DataView web parts: Displaying Items within folders

You have created a Data View webpart which displays items in your document library.
But hold on.... why are items only appearing at the root folder level? All items in subfolders are missing?

Well, either you could use SharePoint designer to change the scope. Personally I would not recommend using this approach as SharePoint Designer is known to corrupt pages with data view web parts once you hit the save button.

Or you could go down to the lowest level, e.g. export out your webpart and altering the code, and then re-upload and add it as a new webpart.
All you need to do is to add one more attribute to the Data Source properties.

Open the .webpart file you downloaded in plain text.
Locate the property called DataSourcesString.
Here you will see the CAML query to retrieve data from your document library.
Locate the sharepoint:SPDataSource node within the property.
It should look similar to this:
<sharepoint:SPDataSource runat="server" DataSourceMode="List" SelectCommand="THE CAML QUERY" UpdateCommand="" InsertCommand="" DeleteCommand="" UseInternalName="True" UseServerDataFormat="True" Scope="Recursive" ID="dataformwebpart3">...some other stuff here...
</sharepoint:SPDataSource>

Add in the highlighted text. Now all items in folders, or at root level will appear in the same flat view.

Thursday, November 28, 2013

Taiwan 10D9N Itinerary - Eat, Shop, and Relax

For my own reference, you are free to take a look :-)

This map was created after many hours spent traversing forums, travel websites, and racking my brains out trying to decipher Mandarin. Focusing on Taichung then Taipei for a leisurely trip, as I don't think traveling across the island is a good plan with heavy luggage in tow.

Day 1:
Upon touching down at Taoyuan International Airport, head directly to Taichung via the HSR (High Speed Rail). Tickets can be purchased online in advance, with a discount for early booking.
If reach Taichung early, we could stroll along West District (經國綠園道)
Spend the night at Taichung at a hotel within walking distance of Fengjia Night Market.

Day 2:
Head out early for a visit to Lavendar Cottage, or Monster Village by bus, followed by a visit to Sun Moon Lake. You could either take a taxi there (if 4 or more), or hop on the bus. Go on a cruise across the lakes to visit the many attractions. Ride the cable car for the marvellous view. The Aboriginal Village Amusement Park is worth a visit if you like One Piece.
Spend the night at Sun Moon Lake.

Wednesday, November 27, 2013

SharePoint 2010: Display scrolling list items using jQuery and SPServices

This is a pretty common requirement for intranet administrators, so today I thought I'd share how to display the contents of a SharePoint list using jQuery. The good part about this is you need to have some knowledge on the CAML query and that's it.

First download these 3 components and store it somewhere accessible on SharePoint. Thanks to the wonderful folks who did the hard work and came up with those great components!
jQuery - http://jquery.com/
jQuery.SPServices - http://spservices.codeplex.com (read documentation thoroughly for compatibility)
jQuery.Marquee from givainc - http://www.givainc.com/labs/marquee_jquery_plugin.cfm
(in the case of jQuery Marquee, make sure you also include the css file for default styling)

Create a simple text file and include references to those components. I am using a plain text file so that I could include it later in a Content Editor Webpart.
 <link rel="stylesheet" href="/sites/SiteCollectionDocuments/jquery.marquee.min.css" />   
 <script src="/sites/SiteCollectionDocuments/jquery-1.8.3.js"></script>  
 <script src="/sites/SiteCollectionDocuments/jquery.marquee.min.js"></script>  
 <script src="/sites/SiteCollectionDocuments/jquery.SPServices-2013.01.min.js"></script>  

Monday, November 25, 2013

SharePoint 2010: How to find broken links using SharePoint Designer

There used to be a feature to show all broken links in SharePoint Designer 2007, unfortunately this is no longer available in SPD2010.

However, you could still find it using a more roundabout way.

Launch SharePoint Designer 2010 and open your site.
Open up ANY page in Edit mode.

Click to the View tab. Expand the task Pane and click on Hyperlinks.


Friday, November 22, 2013

Christmas Decorations at Straits Quay Penang, 2013

It's that special time of the year again... Christmas is just around the corner!

Here are some pics, to share the Christmas cheer...


A Christmas tree made from stacks and stacks of books.


Close-up.

Thursday, November 21, 2013

SharePoint PowerShell: A roundabout approach to mysites cleanup Part I

I had a situation where the company mysites cleanup job was turned off, and we needed a manual process to:
1. Detect mysites whose users who are no longer active in AD (Active Directory)
2. Update the site owner to someone else
3. Delete the user profile (to clean up organizational chart)
4. Remove/archive the mysite after x days.

Practically all articles on the WWW on this topic was to adopt an approach using the UserProfileManager to detect users removed from AD. However, this approach did NOT address my particular need.

This approach assumes that:
1. ALL of your mysites follows the same naming convention e.g. http://mysites/personal/username
2. The inactive users were either (1) totally removed; or (2)still in AD, but was moved to a separate OU (Organizational Unit)

For now, let's focus on detecting mysites where users are no longer active.

Creating tabbed menus with jQuery and CSS

While searching for free code downloads that allow me to create tabbed browsing effects with minimal fuss and zero dependency, I stumbled across this gem: jQueryUI

This is really cool as it makes use of the latest version of jQuery to display nice effects and best of all, it is extremely easy to plug this piece of code onto any environment (SharePoint included) :P

There are a lot more useful utilities out there. I just did not have the luxury of trying them all.

Sunday, November 17, 2013

AgilePoint step by step: Bulk Process Migration

Real World Scenario: AgilePoint BPMS 5.0 SP4

So you have a couple of workflows already deployed to Production, and have hundreds of active processes running. One day your Business User comes to you and says: "Can we do X and Y and then also R,S,T, U while you're making the changes.."

Fine, you think. OK, a couple of days later you deployed the new workflow, and THEN your Business User says: "Look there's a system bug and the issue is not fixed. How come my process is still doing A and B? I thought you have already made changes???"

err.... didn't I already mention that the change would only apply on NEW processes? LOL.

Now here's what you need to do to remedy it!

Monday, November 11, 2013

How to upload InfoPath 2010 attachments to a SharePoint document library without code

It was extremely, insanely hard to get a proper reference to a way to upload InfoPath attachments to a SharePoint document library WITHOUT CODE. I hope this will help you or at least point you in the right direction.

This is for SharePoint 2010.

Firstly in the InfoPath form, create a Query web service Data Connection.
Make the web service call to /_vti_bin/Copy.asmx.wsdl.

Next, select the CopyIntoItems method. Leave all fields blank and proceed to assign the data connection a proper name.



Tuesday, November 5, 2013

Find processes making outgoing HTTP requests using the NETSTAT command

A set of simple commands to trace Internet traffic:

First you want to list out all connections by launching Command Prompt. If not sure which flag to use, type netstat --help to list all available commands.

If you type netstat without any additional flags, only active connections will be listed.
Typing netstat with the flag will list out the process ID as well. e.g. netstat -p

I will usually follow up with running the tasklist command to locate which executable the process belongs to.


Thursday, October 31, 2013

SharePoint & PowerShell: List all alerts (on document libraries, lists) in a site

As a site collection administrator, I find it extremely tedious to go to Site Actions - Site Settings, click on User Alers, and display alerts one by one. Here's a PowerShell script to get the information needed~!

Let's say you have a subsite with the URL http://sharepoint/subsite1

Launch SharePoint 2010 Management Shell and run this script (copy and paste the following, and save it as .ps1).

## Load the website
     $web = Get-SPWeb "http://sharepoint/subsite1/" 
     $resultSet = @() 
         foreach ($alert in $web.Alerts){ 
             $URL = $web.URL + "/" + $alert.ListUrl 
             $result = New-Object PSObject 
             $result | Add-Member -type NoteProperty -name "Title" -value $alert.Title 
             $result | Add-Member -type NoteProperty -name "URL" -value $URL 
             $result | Add-Member -type NoteProperty -name "Alert Type" -value $alert.AlertType 
             $result | Add-Member -type NoteProperty -name "User" -value $alert.User 
             $resultSet += $result 
        } 

## Best practice: dispose when done
    $web.Dispose() 

## Display the result
    $resultsSet 

## To export the result
    $resultSet | Export-Csv "Output.csv"

Tuesday, October 1, 2013

PowerShell script to Monitor and Auto-expand SharePoint site collection quota

Get-SPSite -Limit ALL | 
    Where { $_.Url -like "*/teamsite/*" -and [int]($_.Usage.Storage/1MB) -gt [int](($_.Quota).StorageWarningLevel/1MB) } |
    ForEach-Object {
 $maxSize = ($_.Quota).StorageMaximumLevel + (5000*1MB)
 $maxWarning = $maxSize - (200*1MB)
        Set-SPSite -Identity $_.Url -MaxSize $maxSize -WarningSize $maxWarning
    }

This script will retrieve all Sharepoint site objects where there is a "/teamsite/" found in the URL, and where the current usage has exceeded the user warning level.
It will automatically increment 5 GB of storage quota and update the warning level as well.

However, there are situations where some sites have unlimited quota. In this case, you will have to modify the script slightly to include an additional condition:
Where { $_.Url -like "*/teamsite/*" -and [int](($_.Quota).StorageWarningLevel/1MB) -gt 0 -and [int]($_.Usage.Storage/1MB) -gt [int](($_.Quota).StorageWarningLevel/1MB) }

Monday, August 26, 2013

InfoPath 2010 Programmatically set web service parameters for Data Connection (WebServiceConnection)

When developing InfoPath forms, have you ever needed to dynamically set the parameters of a web service during run time?
I have.

Using the SharePoint Taxonomy web service as an example., here's what I did:
First, I create a Data Connection which points to the TaxonomyClientService web service found in _vtu_bin/TaxonomyClientService.asmx. I am calling the web method GetTermSets.

For this particular web service, there are several parameters that need to be passed in.
You can refer to the other article for more details InfoPath 2010: Populating a dropdown with SharePoint Metadata Termstore

I opt not to automatically retrieve data when form is opened.

For each Data Connection that was created, there will be a corresponding secondary Data Source. I am going to make use of the XML for my dynamic updates.


Tuesday, August 20, 2013

Phuket Island Tour - Maya Bay, Phi Phi Island and Khai Island

Weather: cloudy with occasional thunderstorms
When: mid-July
Places: Maya Bay - Phi Phi Ley, Viking Island, Monkey Beach, Phi Phi Island, Khai Island

After the shuttle bus picked us up from our hotel, we arrived at the pier where the tour guide, a very cute and funny 'lady' named Mary, gave us an entertaining narrative of what to expect during today's tour.
There were a total of 3 speedboats for our group today. (This is merely the off peak season and the tour operator is just one among the many hundreds available in Phuket. So you could imagine the crowd during the peak season...)

Picture of the speedboats.

As we set out from the pier, there was a light drizzle (still ok), but the waves were... scary. I was told that some waves were as high as 3 meters. After enduring one hour of a bumpy ride, we reached the first destination - Maya Bay. Well I certainly wasn't expecting my first sight of the beach to be .. this. Hehe

I was amazed by how well maintained the beach was, given the sheer size of the crowd. Thousands of  visitors flock to the spot every day to catch a glimpse of the famous filming location which is Maya Bay. Some people might know it by the name of James Bond Island.






The turquoise waters and pristine white beach is gorgeous even on a rainy day. It wasn't easy, but I managed to capture some photos with unobstructed views.

Sunday, August 18, 2013

Phuket Island Hopping Trip - How to select your preferred tour

Visiting Phuket in the middle of the monsoon season (mid-year) is always a risk - it could be sunny in the morning, and flash thunderstorms in the afternoon! This made planning extremely difficult.

But since I am already here, why not take a gamble, I thought to myself. To hell with rain or shine.

Island hopping trips in Phuket are divided into 3 main itineraries:
- Sightseeing: James Bond Island, Phang Nga Bay, Canoeing
- A bit of snorkeling: Phi Phi Islands, Maya Bay, Khai Island
- A LOT of snorkeling: Coral Island and Racha Island, OR Similan Island
I went for the Phi Phi Island option. I would have liked to see Phang Nga bay as well but there simply wasn't enough time.
You could either opt for speedboat (faster, more stops) or ferry (leisure)

Getting a tour from Patong beach area is really simple if you are willing to do the price and comparison.


There are so many options available and most of the itineraries are in fact the same. Based on my personal experience, here's what to do when selecting a tour:
- Price! Cheaper during monsoon seasons, you should be able to get Phi Phi around 1000-1100 baht after discount. For Phang Nga, it's probably around 1000 baht. I did not check for others. This is per 2013.
- Do not be greedy and go for the itineraries with the most stops during the monsoon season. It will be hugely dependent on weather conditions.
- Try to book a couple of days in advance and don't rush to book the first (cheap) package you see. There's always a better deal at the next tour operating just a few steps ahead.
- Some operators will offer more discounts if you book in a group of 4 or more.


Just walk around and ask. There are at least dozens, if not hundreds of options.

Thursday, August 15, 2013

Intermittent error: The type initializer for '' threw an exception

I had built a web application to consume SharePoint 2010 Word Automation Services to perform PDF rendition. From time to time, I noticed this exception would be thrown:

System.TypeInitializationException: The type initializer for '' threw an exception. ---> System.TypeInitializationException: The type initializer for '' threw an exception. ---> .ModuleLoadException: The C++ module failed to load while attempting to initialize the default appdomain.
 ---> System.ArgumentException: Invalid token for impersonation - it cannot be duplicated.
   at System.Security.Principal.WindowsIdentity.CreateFromToken(IntPtr userToken)
   at System.Security.Principal.WindowsIdentity..ctor(SerializationInfo info)
   at System.AppDomain.get_Id()

After Googling around I arrived at the conclusion that somehow, the user account I am impersonating have its token expire after prolonged use, and was refused by the Word Automation Services. I'm too lazy to list references and explanations so let's dive into a simple workaround straightaway!

InfoPath 2010: Populating a dropdown with SharePoint Metadata Termstore

In one of my projects, I had to build an InfoPath 2010 form needs to populate a couple of dropdown lists with values from the SharePoint metadata term store.

In a nutshell, this is how I managed to get it working:
Using PowerShell, I extracted the IDs of the Metadata service name, and the IDs of the term set name.

$col = Get-SPSite http://sharepoint
#Get TermStore ID
$taxonomySession = Get-SPTaxonomySession -site $col
$termStore = $taxonomySession.TermStores["Managed Metadata Service"]
$termStore.Id

#Get TermSet ID
$termStoreGroup = $termStore.Groups["Departments"]
$termSet.Id

SharePoint 2010 and Javascript: Coding a Popup Modal Dialog

Ever wondered how to embed a popup modal dialog in SharePoint? Here's the javascript needed to do the trick:
// Here I am passing the current list ID and list item ID as a querystring parameter to an aspx page to perform some functions

function CustomOpenDialog(listid, listitemid) {
    var options = SP.UI.$create_DialogOptions();
    var url = SP.ClientContext.get_current().get_url();
    options.url = url + '/SitePages/MyTestPage.aspx?listid=' + listid + "&listitemid=" + listitemid;
    options.width = 500;
    options.height = 400;
    options.dialogReturnValueCallback = Function.createDelegate(null, CloseCallback);
    SP.UI.ModalDialog.showModalDialog(options);
}

var messageId;


function CloseCallback(result, target) {
    if (result === SP.UI.DialogResult.OK) {
        if (target != 'bye') {
            //Get id
            messageId = SP.UI.Notify.addNotification('<img src="_layouts/images/loading.gif">Loading... <b>' + target + '</b>...', true, 'Dialog Response', null);
            //do someother work here.
        }
        else //target=='bye'
        {
            SP.UI.Notify.removeNotification(messageId); //simple way to remove it.
            return;
        }
    }
    if (result === SP.UI.DialogResult.cancel) {
        SP.UI.Notify.addNotification('Operation was cancelled...', false, '', null);
    }
}

This is by no means a complete solution. Most of the time, you will find yourself working with either SharePoint Designer or Visual Studio to provide a more comprehensive solution.

Happy Sharing the Point!

Monday, February 25, 2013

SharePoint 2010 C# set document set permissions

Ever needed to change permissions to a document set? Here's a sample of how you do it.

e.g. document set on http://sharepoint/Site1/Library1/DocumentSet1
Example of Parameters:
siteUrl:
webRelativeUrl:
libraryName:
folderName:
itemUrl:
roleMaps:
removeExistingPermission:


Related Posts Plugin for WordPress, Blogger...