Archive

Posts Tagged ‘SharePoint online’

How to replace the SharePoint date calendar control with more user friendly jQuery calendar control

April 26, 2014 1 comment

When you use the SharePoint date and time type for date of birth field, you will notice that the calendar control is extremely non-user-friendly. You can only navigate month by month as shown below. To resolve the issue, you can customize the list form page using SharePoint designer and replace the OOB calendar control with popular jQuery control. The solution works for both SharePoint 2010,2013 and office365.

Here are the steps for how to achieve this.

1. Open SharePoint designer and create a New List Form called customNew and set as default form for the selected type.

2. Open style library in file explorer and copy jQuery and jQuery UI files into the style library in SharePoint site.

You can download the jQuery and jQuery UI from the web and the content of the contactPersonCustomNewForm.js is as below. I use the dd/mm/yy format as my locale in Regional Settings is English(New Zealand). You need to change this if you live in another country with different date format

$(document).ready(function() {
    	$("img#ctl00_m_g_540b9a50_52dc_4400_a58d_1db99555fddf_ff41_ctl00_ctl00_DateTimeField_DateTimeFieldDateDatePickerImage").parent().hide();
 		$("img#ctl00_m_g_540b9a50_52dc_4400_a58d_1db99555fddf_ff41_ctl00_ctl00_DateTimeField_DateTimeFieldDateDatePickerImage").hide();
	    $("input#ctl00_m_g_540b9a50_52dc_4400_a58d_1db99555fddf_ff41_ctl00_ctl00_DateTimeField_DateTimeFieldDate").datepicker({
		    changeMonth:true,
		    changeYear:true,
		    showOn: "button",
			buttonImage: "/_layouts/images/calendar.gif",
			buttonImageOnly: true,
			defaultDate:"01/01/1970",
			yearRange: "c-20:c+20",
			dateFormat: "dd/mm/yy"
	    });
});

In order to get the image and textbox selector above , you can open IE developer toolbar(click F12) and find the control ID as below:

3. Open SharePoint designer and edit the newly created New List Form customNew.aspx in advance mode. Then copy and paste the following links in the PlaceHolderAdditionalPageHead.

	<SharePoint:CssRegistration name="<%$SPUrl:~SiteCollection/Style Library/themes/ui-lightness/jquery-ui.css%>" runat="server"/>
	<SharePoint:ScriptLink language="javascript" name="~sitecollection/Style Library/jquery-1.10.2.js" Defer="false" runat="server"/>
	<SharePoint:ScriptLink language="javascript" name="~sitecollection/Style Library/jquery-ui-1.10.4.custom.min.js" Defer="false" runat="server"/>
	<SharePoint:ScriptLink language="javascript" name="~sitecollection/Style Library/contactPersonCustomNewForm.js" Defer="false" runat="server"/>

 

4. Now go to the list and click add, you will see the new calendar control as shown below

Advertisements

How to register your Office365 30 days trial

September 8, 2012 Leave a comment

In this post, I’d like to show you how to register your Office365 30 days trial. It is extremely easy and the steps are as below:

1. Go to Office365 home page

2. Click on Free Trial and choose the options depending on your business requirement, I will choose Plan E3.


3. Fill in the details and create your trial


4. Choose your access account then click Save and continue.


5. Here is landing page for your Office 365 account.

How to call Office365 web service in a Console application using WCF

June 25, 2012 1 comment

In my previous post, I showed you how to call the SharePoint web service using a console application. In this post, I’d like to show you how to call the same web service in the cloud, aka Office365.In office365, it uses claims authentication as opposed to windows authentication for normal in-house SharePoint Deployment. For Details of the explanation you can see Wictor’s post on this here. The key to make it work is to understand when you authenticate from Office365, you get your authentication token. You then need to pass this token to your HTTP request as cookie to make the web service call. Here is the code sample to make it work.I have modified Wictor’s by removing the client object references.

static void Main(string[] args)
{
MsOnlineClaimsHelper claimsHelper = new MsOnlineClaimsHelper( "admin@ybbest.onmicrosoft.com", "YourPassword","https://ybbest.sharepoint.com/");
HttpRequestMessageProperty p = new HttpRequestMessageProperty();
var cookie = claimsHelper.CookieContainer;

string cookieHeader = cookie.GetCookieHeader(new Uri("https://ybbest.sharepoint.com/"));
p.Headers.Add("Cookie", cookieHeader);
using (ListsSoapClient proxy = new ListsSoapClient())
{
proxy.Endpoint.Address = new EndpointAddress("https://ybbest.sharepoint.com/_vti_bin/Lists.asmx");

using (new OperationContextScope(proxy.InnerChannel))
{
OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = p;
XElement spLists = proxy.GetListCollection();
foreach (var el in spLists.Descendants())
{
//System.Console.WriteLine(el.Name);
foreach (var attrib in el.Attributes())
{
if (attrib.Name.LocalName.ToLower() == "title")
{
System.Console.WriteLine("> " + attrib.Name + " = " + attrib.Value);
}
}
}
}
System.Console.ReadKey();
}
}

You can download the complete code from here.

Reference:

Managing shared cookies in WCF

How to do active authentication to Office 365 and SharePoint Online