Posts

Showing posts from October, 2015

SharePoint: How do I get the location of the MySite url using PowerShell?

[void][reflection.assembly]::Loadwithpartialname("Microsoft.Office.Server"); [void][reflection.assembly]::Loadwithpartialname("Microsoft.Office.Server.UserProfiles"); [void][reflection.assembly]::Loadwithpartialname("System.Web"); [void][reflection.assembly]::Loadwithpartialname("Microsoft.SharePoint"); $mySiteUrl = "http://mysitecollection.com" $sc = Get-SPServiceContext($mySiteUrl) $upm = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($sc) Write-Host $upm.MySiteHostUrl NOTE: If you encounter a 'Permission Denied' error, make sure that your user has 'Full Control' permissions on the User Profile Service.

SharePoint: How do I upload a file structure to a document library?

My current project uses a custom 'style library' document library. The deployment process needed to replicate the files and file structure from the disk in the target library. I used CSOM and Powershell to solve the problem. I created a 'Common' dll that contains the methods I needed: 1. CreateFolder (to create a folder structure) 2. UploadFile (to load the file).     public static class FileHelper     {         public static Folder CreateFolder(Web web, string listTitle, string fullFolderPath)         {             if (string.IsNullOrEmpty(fullFolderPath))                 throw new ArgumentNullException("fullFolderPath");             var list = web.Lists.GetByTitle(listTitle);             return CreateFolderInternal(web, list.RootFolder, fullFolderPath);         }...

JQuery DatePicker: How do I add a watermark?

A watermark is always a great way to provider a meaningful hint to a user. Using the JQuery DatePicker control, I wanted to tell the user the expected format of the date.  I added a new class called 'watermarkrequired' to the required html elements to help me identify them. I looked at several option: 1. Using the blur and focus events. $('.watermarkrequired').blur(function () { if ($(this).val().length == 0)    $(this).val(watermark).addClass('watermark'); }).focus(function () { if ($(this).val() == watermark)     $(this).val('').removeClass('watermark'); }).val(watermark).addClass('watermark'); 2. Using the 'AppendText' option of the DatePicker $( ".watermarkrequired" ).datepicker( "option", "appendText", "(yyyy-mm-dd)" ); Finally, I settled on the placeholder attribute $( ".watermarkrequired" ).attr("placeholder", "dd/mm/yyyy");