<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Himanshu's Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/himanshukumar/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/himanshukumar/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:50:10 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>How to Migrate SharePoint 2007 to Office 365 Standard Using Native Web Service and CSOM</title>
      <link>https://docs.microsoft.com/archive/blogs/himanshukumar/how-to-migrate-sharepoint-2007-to-office-365-standard-using-native-web-service-and-csom</link>
      <pubDate>Mon, 21 May 2012 19:40:00 GMT</pubDate>
      <dc:creator><![CDATA[Himanshu Saxena]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/himanshukumar/2012/05/21/how-to-migrate-sharepoint-2007-to-office-365-standard-using-native-web-service-and-csom/</guid>
      <description><![CDATA[This post talks about:
1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; How to migrate from SharePoint 2007 to...]]></description>
      <content:encoded><![CDATA[<p>This post talks about:</p>
<p>1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; How to migrate from SharePoint 2007 to Office 365 Standard with native web service and CSOM</p>
<p>2)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Issues you would face during the migration and alternatives</p>
<p>To migrate to Office-365 &ndash; S using NWS you would have to either write your own tool to pump the content or use migration tools available in market. Writing your own tool would be time consuming and there are tools available in the market to do so.</p>
<p>Let me talk about issues first and then I will list down the steps to do the migration activity.</p>
<p><span style="font-size: x-large;">Issues</span></p>
<p style="padding-left: 30px;"><strong><span style="font-size: small;">Custom web parts related issues</span></strong></p>
<p style="padding-left: 30px;">1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Any custom coded web part won&rsquo;t be migrated by migration tools. You will have to package your web parts as WSPs and deploy as Sandbox solution.</p>
<p style="padding-left: 30px;">2)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Since SharePoint execution model in O365-S is sandboxed, you will have to convert all your custom web parts to be runnable in Sandboxed environment. Sandbox is a restricted execution model so you will have to look for alternatives for features which are restricted. Below are some of the restrictions and alternatives</p>
<ol style="padding-left: 30px;"><ol>
<li><b>Response.Redirect doesn&rsquo;t work</b> &ndash; Use client side redirection. For any conditional redirection from server code, use flags and override &ldquo;Render&rdquo; method to inject jQuery to do redirection on document ready event</li>
<li><b>Run with elevated privileges won&rsquo;t work</b> &ndash; if you are writing to some list in your code make sure to give all users&nbsp;proper permissions on the list and your code would work.</li>
<li><b>ASP.Net client side validations won&rsquo;t work</b> &ndash; use jQuery or javascript to do client side validations</li>
<li><b>File I/O related operations won&rsquo;t work</b> &ndash; like export to excel or PDF won&rsquo;t work the way it is generally coded, so use SPFile.SaveBinary to write into a document library and redirect user to the link of the created file.</li>
<li><b>Will add more limitations and alternatives later</b>.</li>
</ol></ol>
<p style="padding-left: 30px;"><strong><span style="font-size: small;">Custom master pages, layouts and content types</span></strong></p>
<p style="padding-left: 60px;">1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Any custom master page, page layouts won&rsquo;t be migrated by migration tools. So you should deploy these master pages and layouts as WSP solutions. Don&rsquo;t forget to convert your 2007 master page to 2010 based master page, follow this article &ldquo;https://msdn.microsoft.com/en-us/library/ee539981.aspx&rdquo;.</p>
<p style="padding-left: 60px;">2)&nbsp;&nbsp;&nbsp;&nbsp;Content types will get migrated by migration tools but content type GUID will change and as a result your layouts won&rsquo;t work referring to old GUID. Solution is to deploy content type also using WSP to retain GUID.</p>
<p style="padding-left: 30px;"><strong><span style="font-size: small;">Application pages</span></strong></p>
<p style="padding-left: 60px;">3)&nbsp;&nbsp;&nbsp;&nbsp;Application pages are not supported, so convert your application pages to Sandboxed Visual Web Part and provision site pages hosting these web parts.</p>
<p style="padding-left: 30px;"><strong><span style="font-size: small;">User profiles</span></strong></p>
<p style="padding-left: 60px;">1)&nbsp;&nbsp;&nbsp;&nbsp;UserProfileManager and AudienceManager are not available in Sandbox so to fetch user profile properties use a hidden list called &ldquo;SiteUserInfoList&rdquo;. This list has a minimal set of user profile properties synchronised to it. If you need to synchronize more properties just go to UPSA administration and check if the property you want to synchronised is replicable or not.</p>
<p style="padding-left: 30px;"><span style="font-size: small;"><b>External content types and integration</b></span></p>
<p style="padding-left: 60px;">1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; O365 E3 plan supports BCS for external integration. However in E1 plan BCS is not available, here you expose your external system as a WCF and consume the WCF in Sandbox Visual Web Part using jQuery AJAX and JSONP. The WCF can be anonymous and authenticated as well using both NTLM/Kerberos.</p>
<p style="padding-left: 30px;"><span style="font-size: small;"><b>Exception handling and logging</b></span></p>
<p style="padding-left: 60px;">1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Exceptions cannot be logged to ULS. However you can log your exceptions to a custom list and the list can be cleared periodically. But one should try to write exception proof code as much as possible cause each exception raised will increase your resource usage and if your daily quota passes your site will come down until next day.</p>
<p style="padding-left: 30px;"><span style="font-size: small;"><b>Deployment</b></span></p>
<p style="padding-left: 60px;">1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Solutions can be easily uploaded as user solutions in Solution gallery. Content can be created/edited using client side object model also.</p>
<p style="padding-left: 30px;"><span style="font-size: small;"><b>Timer jobs</b></span></p>
<p style="padding-left: 60px;">1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Timer jobs are not available.</p>
<p style="padding-left: 30px;"><span style="font-size: small;"><b>Feature and EventReceivers</b></span></p>
<p style="padding-left: 60px;">1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Both are available.</p>
<p style="padding-left: 30px;"><span style="font-size: small;"><b>Data export issues</b></span></p>
<p style="padding-left: 60px;">With SharePoint Native Web Services to import and export data there would be limitations in terms what all can you do. Below are details:</p>
<p style="padding-left: 60px;">1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If you migrate your lists with any migration tool, your list GUID will change, as a result your code, OOB web parts will break. So fix your code and fix web parts after migration.</p>
<p style="padding-left: 60px;">2)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; List item Ids will also change.</p>
<p style="padding-left: 60px;">3)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Migrate your lists and libraries before your migrate your site pages, so that when the list is referenced from your web part during page migration, it does not break.</p>
<p style="padding-left: 60px;">4)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Content migration will not be fast, so plan accordingly.</p>
<p style="padding-left: 60px;">5)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; To maintain document metadata (like CreatedBy, ModifiedBy etc), you will have to map all on premise users to corresponding Office-365 users. If you don&rsquo;t these fields will have credentials of logged-in user under which you created connection to SharePoint Online site collection.</p>
<p style="padding-left: 60px;">6)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Migration tools provide you to map the on-premise users to O365 users.</p>
<p style="padding-left: 60px;">7)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Blog sites will be migrated but post to comments mapping will be lost,so write your own tool to migrate blog sites.</p>
<p style="padding-left: 60px;">8)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Page layout URL field of Pages library for migrated pages will refer to source layout URL, write an admin tool to fix it. Basically they migrate the fields as it is without fixing the layout URL to refer to the new URL.</p>
<p style="padding-left: 60px;">9)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Make sure to publish and approve all master pages and layouts otherwise the tool won&rsquo;t be able to load them and continue to throw exceptions during migrations.</p>
<p style="padding-left: 60px;">10)&nbsp;&nbsp; Lists and libraries will be migrated but lookup column associations will break, you will have to manually or by some tool fix the associations.</p>
<p><span style="font-size: x-large;">Migration Steps</span></p>
<p style="padding-left: 60px;"><b><span style="text-decoration: underline;">Planning and Approach</span></b></p>
<ol style="padding-left: 60px;">
<li>Dev &amp; test environment<b></b></li>
<ul>
<li>In O365-S you start your information architecture creation from site collection onwards. So you can use different site collections as your development and test environment. The catch here is that your URL will be changed per site collection so make sure to do the following:</li>
<ul>
<li>Use relative paths in CSS/JS/C#.</li>
<li>Use a custom configuration list to store any URL if you need to, so that you can change it when you deploy to different site collections.</li>
</ul>
<li>Map your on-premise site collections to online site collection</li>
</ul>
<li>Configure ADFS for single sign&nbsp;on using Smart Links. &ldquo;https://community.office365.com/en-us/w/sso/using-smart-links-or-idp-initiated-authentication-with-office-365.aspx?Sort=MostRecent&amp;PageIndex=1&rdquo;</li>
</ol>
<p style="padding-left: 60px;"><b><span style="text-decoration: underline;">Build</span></b></p>
<ol style="padding-left: 60px;">
<li>Setup solutions and WSPs</li>
<li>Convert your custom web parts to be sandbox compatible and application pages to sandboxed visual web parts</li>
<li>Created required site pages.</li>
<li>Create WSP packages.</li>
</ol>
<p style="padding-left: 60px;"><b><span style="text-decoration: underline;">Migration Steps</span></b></p>
<ol style="padding-left: 60px;">
<li>Create your information architecture (site collections, sites, lists etc.). Sub-sites, lists can be created using feature receivers and CSOM.</li>
<li>Deploy WSPs</li>
<li>Publish and approve master pages,layouts.</li>
<li>Migrate lists and libraries. For each migration step the tools allow to generate a PowerShell script. So for each successful migration generate a PoweShell, if you want to do scripted migration later just by changing the URLs.</li>
<li>As you migrate lists and libraries you will be able to migrate versioning, item level permissions, OOB web parts etc.</li>
<li>List views won&rsquo;t be migrated, so write a tool using CSOM to create list views and run it once list migration is over.</li>
<li>Migrate pages library.</li>
<li>Run tool to migrate blog sites if you have.</li>
<li>Run admin web part to fix page layout URLs.</li>
<li>Fix your ListViewWebParts and other webparts which rely on list GUIDs, cause list GUID is changed.</li>
<li>Sniff your pages, fix UI issues.</li>
<li>Migration done :).</li>
</ol>]]></content:encoded>
    </item>
    <item>
      <title>Asp.Net Textbox with jQuery UI Datepicker value lost on a postback</title>
      <link>https://docs.microsoft.com/archive/blogs/himanshukumar/asp-net-textbox-with-jquery-ui-datepicker-value-lost-on-a-postback</link>
      <pubDate>Sat, 05 Nov 2011 06:36:00 GMT</pubDate>
      <dc:creator><![CDATA[Himanshu Saxena]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/himanshukumar/2011/11/05/asp-net-textbox-with-jquery-ui-datepicker-value-lost-on-a-postback/</guid>
      <description><![CDATA[In this post I am going to talk about an issue I faced while using jQuery Datepicker control wherein...]]></description>
      <content:encoded><![CDATA[<p>In this post I am going to talk about an issue I faced while using jQuery Datepicker control wherein the datepicker was losing the date on post back. The text boxes were losing the dates even when the view state was enabled for the text boxes and/or page, unexpected.</p>
<p><span style="color: #000000; font-size: large;">Scenario</span></p>
<p>I was working on a web application and had to develop a form that manipulates (Creates/Edits) schedule information (Start/End Date) for a job. I had four types of schedules (Daily, Weekly, Monthly, and Quarterly). Schedules could be infinite as well wherein there will be no end-date for the schedule. The user was allowed to enter date by typing it or by selecting from datepicker. There were different client/side and server side validations I had to do on the dates input by the user.</p>
<p><span style="color: #000000; font-size: large;">Solution</span></p>
<p>I tried to work it out by using the <b>alternate field</b> feature that jQuery datepicker offers. I used hidden field to store the date selected/entered by the user. But in this approach it was tricky to keep sync between the main text box to which datepicker is attached to and the hidden field. Refer to code snippets below to find how hidden field was attached to the datepicker:</p>
<p><span style="color: #000000; font-size: medium;">Control (ASCX) Markup</span></p>
<p></p>
<pre class="scroll"><code class="html">&lt;table class="table-General"&gt;<br /> &lt;tr&gt;<br /> &lt;td&gt;<br /> &lt;asp:CheckBox ID="chkEnableMonthlyNotifications" runat ="server" CssClass="cell-Text" Text="Enable monthly notifications." /&gt;<br /> &lt;br/&gt;<br /> &lt;/td&gt; <br /> &lt;/tr&gt; <br /> &lt;tr&gt; <br /> &lt;td class="td-General"&gt;<br /> &lt;label for="txtMonthStartDate" class="cell-Text"&gt;Specify start date for monthly notification&lt;/label&gt;<br /> &lt;br /&gt;<br /> &lt;br /&gt; <br /> &lt;asp:TextBox ID="txtMonthStartDate" runat="server" Enabled="true"&gt;&lt;/asp:TextBox&gt; <br /> &lt;asp:HiddenField ID="hdnMonthStartDate" runat="server" /&gt; <br /> &lt;/td&gt; <br /> &lt;/tr&gt; <br /> &lt;tr&gt; <br /> &lt;td class="td-General"&gt; <br /> &lt;label for="txtMonthEndDate" class="cell-Text"&gt;Specify end date for monthly notification, or leave blank if no end date.&lt;/label&gt;<br /> &lt;br /&gt;<br /> &lt;br /&gt; <br /> &lt;asp:TextBox ID="txtMonthEndDate" runat="server" Enabled="true" &gt;<br /> &lt;/asp:TextBox&gt; <br /> &lt;asp:HiddenField ID="hdnMonthEndDate" runat="server" /&gt; <br /> &lt;/td&gt; <br /> &lt;/tr&gt; <br /> &lt;/table&gt;<br /> </code></pre>
<p class="scroll"><code class="html"></code><span style="color: #000000; font-size: medium;">jQuery to Initialize Datepicker with Alternate Field</span></p>
<p>&nbsp;</p>
<pre class="scroll"><code class="js">$(document).ready(function () { <br /> $("[id$=_txtMonthStartDate]").datepicker({ showOn: 'button', buttonImageOnly: true, buttonImage: '/icon_cal.png', altField: '[id$=_hdnMonthStartDate]' }); <br /> $("[id$=_txtMonthEndDate]").datepicker({ showOn: 'button', buttonImageOnly: true, buttonImage: '/icon_cal.png', altField: '[id$=_hdnMonthEndDate]' }); <br /> $("[id$=_txtQuarterStartDate]").datepicker({ showOn: 'button', buttonImageOnly: true, buttonImage: '/icon_cal.png', altField: '[id$=_hdnQuarterStartDate]' }); $("[id$=_txtQuarterEndDate]").datepicker({ showOn: 'button', buttonImageOnly: true, buttonImage: '/icon_cal.png', altField: '[id$=_hdnQuarterEndDate]' }); $("[id$=_txtHalfYearStartDate]").datepicker({ showOn: 'button', buttonImageOnly: true, buttonImage: '/icon_cal.png', altField: '[id$=_hdnHalfYearStartDate]' }); $("[id$=_txtHalfYearEndDate]").datepicker({ showOn: 'button', buttonImageOnly: true, buttonImage: '/icon_cal.png', altField: '[id$=_hdnHalfYearEndDate]' }); $("[id$=_txtYearStartDate]").datepicker({ showOn: 'button', buttonImageOnly: true, buttonImage: '/icon_cal.png', altField: '[id$=_hdnYearStartDate]' }); <br /> $("[id$=_txtYearEndDate]").datepicker({ showOn: 'button', buttonImageOnly: true, buttonImage: '/icon_cal.png', altField: '[id$=_hdnYearEndDate]' }); <br /> }</code></pre>
<p>To avoid difficulties to keep the two fields in sync as the user plays with the date field, I tried to set the date picker value again on &ldquo;document.ready&rdquo; after the post back. I did the following:</p>
<p>1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Checked if the text box has the attribute called &ldquo;Value&rdquo; present.</p>
<p>2)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If the attribute is present I checked if it has some value which the user entered/selected before postback.</p>
<p>3)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If the value is there I used jQuery datepicker API option called &ldquo;setDate&rdquo; to initialize the datepicker again with the value user entered. Refer to the jQuery snippet below:</p>
<p><span style="color: #000000; font-size: medium;">jQuery Code to set Datepicker date again</span></p>
<pre class="scroll"><code class="js">$(document).ready(function () { <br /> //Initializing the datepicker <br /> $("[id$=_txtMonthStartDate]").datepicker({ showOn: 'button', buttonImageOnly: true, buttonImage: '/icon_cal.png', altField: '[id$=_hdnMonthStartDate]' }); <br /> //Code to set the datepicker's date again after post back <br /> if(!($("[id$=_txtMonthStartDate]").attr("Value") == undefined)) <br /> { <br /> if($("[id$=_txtMonthStartDate]").attr("Value").length &gt; 0) <br /> { <br /> $("[id$=_txtMonthStartDate]").datepicker("setDate",new Date($("[id$=_txtMonthStartDate]").val($("[id$=_txtMonthStartDate]").attr("Value")))); <br /> } <br /> } <br /> }</code></pre>
<p>&nbsp;</p>
<p>This solved the problem and datepickers did not lose the value after post backs.</p>
<p><span style="font-size: small;">jQuery selectors can be optimized by using dynamically generated control Id or by using jQuery selector that selects element based on a CSS class.</span></p>]]></content:encoded>
    </item>
  </channel>
</rss>