﻿<?xml version="1.0" encoding="UTF-8"?>
<!--RSS generated by Windows SharePoint Services V3 RSS Generator on 5/19/2012 9:32:33 AM-->
<?xml-stylesheet type="text/xsl" href="/_layouts/RssXslt.aspx?List=a3b8b815-3ac4-4b4d-9c26-e14809d97525" version="1.0"?>
<rss version="2.0">
  <channel>
    <title>Blog: Posts</title>
    <link>http://blog.viaecole.se/Lists/Posts/AllPosts.aspx</link>
    <description>RSS feed for the Posts list.</description>
    <lastBuildDate>Sat, 19 May 2012 07:32:33 GMT</lastBuildDate>
    <generator>Windows SharePoint Services V3 RSS Generator</generator>
    <ttl>60</ttl>
    <image>
      <title>Blog: Posts</title>
      <url>/_layouts/images/homepage.gif</url>
      <link>http://blog.viaecole.se/Lists/Posts/AllPosts.aspx</link>
    </image>
    <item>
      <title>CreateMemberWithPropertiesEx</title>
      <link>http://blog.viaecole.se/Lists/Posts/ViewPost.aspx?ID=4</link>
      <description><![CDATA[<div><b>Body:</b> <div class=ExternalClassBDF9D83FBDF54F92B31AB82374DA69C4>
<p>This article applies to Microsoft Live@edu program and using e-mail with Outlook Live or Hotmail. </p>
<p>There are many ways to create Live users with Live@edu. The easiest way is to use WLAC (Windows Live Admin Center), which you can access at <a href="https://domains.live.com/">https://domains.live.com</a>. Another way is to use Powershell: </p>
<p><span style="font-family:Courier New;font-size:9pt">New-Mailbox -Name &quot;AStudent&quot; -FirstName Able -LastName Student -DisplayName &quot;A Student&quot; -WindowsLiveID astudent@mydomain.edu -Password (ConvertTo-SecureString 'P@ssw0rd' -AsPlainText -Force) -MailboxPlan GalDisabledMailboxPlan </span></p>
<p>(For information how to connect to Live@edu with Powershell, see <a href="http://help.outlook.com/">http://help.outlook.com</a>) </p>
<p>For bulk creating you can either upload a file to WLCA or use Powershell and CSVparser. For more information about Powershell and CSVparser, read this article by Jonny Chambers: <a href="http://liveatedu.spaces.live.com/blog/cns!C76EAE4D4A509FBD!798.entry">http://liveatedu.spaces.live.com/blog/cns!C76EAE4D4A509FBD!798.entry</a> </p>
<p>One thing all these methods have in common is that they force the user to add additional information when accessing the account, e.g. secret question, region and event the password. </p>
<p><img alt="" src="/Lists/Photos/111109_0828_CreateMembe1.png"> </p>
<p>By setting these parameters when creating the account, the request will be limited to an acceptance of the user agreements: </p>
<p><img alt="" src="/Lists/Photos/111109_0828_CreateMembe2.png"> </p>
<p>Instead of using Powershell and CSVParser, you can use the APIs for account provisioning. There is a method which creates a new member in a domain with additional credentials and properties, <span style="font-family:Courier New;color:black;font-size:10pt">CreateMemberWithPropertiesEx</span>:<span style="font-family:Courier New;color:black;font-size:10pt"> <a href="http://msdn.microsoft.com/en-us/library/bb963920.aspx"></span>http://msdn.microsoft.com/en-us/library/bb963920.aspx </p>
<p><em>Calling this method requires Microsoft approval. Contact us at dsupport@microsoft.com if you are a partner and want to apply for permission. </em></p>
<p>Send an e-mail to <a href="mailto:dsupport@microsoft.com">dsupport@microsoft.com</a> and ask them to grant access to the restricted method CreateMemeberWithPropertiesEx. </p>
<p>Download the Command Line application. The Command Line application is also a part of the SDK and can be downloaded here:  <a title="http://go.microsoft.com/fwlink/?LinkID=86932&amp;clcid=0x409" href="http://go.microsoft.com/fwlink/?LinkID=86932&amp;clcid=0x409" target="_blank">http://go.microsoft.com/fwlink/?LinkID=86932&amp;clcid=0x409</a>. Open the solution for CommandLineAdv.<br><br><img alt="" src="/Lists/Photos/111109_0828_CreateMembe3.png"><br></p>
<p>The CommandLineAdv does not contain a method for CreateMemberWithPropertiesEx, so you need to add it to ManageDomain2.cs. Add this piece of code right after the method CreateMemberWithProperties. </p>
<p><img alt="" src="/Lists/Photos/111109_0828_CreateMembe4.png"> </p>
<p>Next step is to make sure Class1.cs can handle the new method. Add the following piece of code, preferable after if (addMember):<br></p>
<p><img alt="" src="/Lists/Photos/111109_0828_CreateMembe5.png" width=564 height=357> </p>
<p>For this example I have added code for all parameters in the method, but you can naturally add them as input parameters to the console application. </p>
<p>Next step is to make the console application recognize a new command. For creating a new user you enter –a, as in <em>add member</em>. Suitable for this example could be –ax, for <em>add extended member</em>. First you need to declare a Boolean which tells the application to create an extended member. In Class1.cs, where the members are declared, add </p>
<p style="margin-left:36pt">bool addMemberEx = false; </p>
<p style="margin-left:36pt"> </p>
<p><img style="width:267px;height:106px" alt="" src="/Lists/Photos/111109_0828_CreateMembe6.png" width=279 height=120> </p>
<p>Where the input parameters are checked, add: </p>
<p style="margin-left:36pt">else if (args[i] == &quot;-ax&quot;) </p>
<p style="margin-left:36pt">    addMemberEx = true; </p>
<p> </p>
<p><img alt="" src="/Lists/Photos/111109_0828_CreateMembe7.png" width=482 height=156> </p>
<p>Last step is to test the application. Compile it and go to a command prompt. Enter for instance: </p>
<p>CommandLine.exe –au:admin@mydomain.edu –ap:MyPassword –ax –m:newuser –p:NewUserPassword –d:mydomain.edu –fcp:0 </p>
<p>You will see the response: </p>
<p>Signing admin into the service… Admin signed into the service. </p>
<p>Adding extended member newuser@mydomain.edu... Extended Member added. </p>
<p>The user is now created with extended parameters and will be sent directly to the inbox when logging on the first time. When accessing SkyDrive or other Live services all that is needed is an acceptance of user agreements.</p></div></div>
<div><b>Category:</b> Live@edu</div>
<div><b>Published:</b> 11/11/2009 9:36 AM</div>
]]></description>
      <author>Andreas Svensson</author>
      <category>Live@edu</category>
      <pubDate>Wed, 11 Nov 2009 08:33:59 GMT</pubDate>
      <guid isPermaLink="true">http://blog.viaecole.se/Lists/Posts/ViewPost.aspx?ID=4</guid>
    </item>
    <item>
      <title>Renaming an uploaded document</title>
      <link>http://blog.viaecole.se/Lists/Posts/ViewPost.aspx?ID=3</link>
      <description><![CDATA[<div><b>Body:</b> <div class=ExternalClass5AEAF4734F604913BC4A543FFEE7C774>
<p>Paul Gavin describes a way to rename uploaded documents in a SharePoint library (<a href="http://paulgalvin.spaces.live.com/Blog/cns!1CC1EDB3DAA9B8AA!655.entry">http://paulgalvin.spaces.live.com/Blog/cns!1CC1EDB3DAA9B8AA!655.entry</a>). One of the problems this solution may generate is when you have added extra columns to the document library. SharePoint handles documents in two steps. First it uploads the document (Upload.aspx) and then it adds the extra properties (EditForm.aspx). When uploading a document you will get redirected to EditForm.aspx only if there have been columns added to the document library. Since changing name of a file is an asynchronous process, this may occur <em>after </em>you have been redirected to EditForm.aspx, which will cause an annoying error message when saving the properties: </p>
<p><img alt="" src="/Lists/Photos/111109_0816_Renaminganu1.png"> </p>
<p>The easiest way to get around this is to instruct the users not save the properties by clicking cancel. A more user friendly way is to stop EditForm.aspx from showing up and redirect the users back to the document library. This article describes the latter case and builds on Paul Gavin's solution. </p>
<p>First of all, create a custom folder with a unique EditForm.aspx. It is recommended to have a separate list definition, especially when combining with other features. Create a code file named <em>EditForm.cs </em>and add it to a separate folder. </p>
<p><img alt="" src="/Lists/Photos/111109_0816_Renaminganu2.png"> </p>
<p><em>Note that the event receiver needed for changing name of the uploaded file has been omitted. </em></p>
<p>Open the EditForm.aspx-page, add the current assembly and modify the Page attributes according to the figure below. </p>
<p><span style="font-family:Tahoma;font-size:10pt"><span style="color:black">&lt;%</span><span style="color:blue">@</span><span style="color:black"> </span><span style="color:#a31515">Assembly</span><span style="color:black"> </span><span style="color:red">Name</span><span style="color:blue">=&quot;ViaEcole.MyCustomFolder, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9750e819ae02b811&quot;</span><span style="color:black"> %&gt; </span></span></p>
<p><span style="font-family:Tahoma;font-size:10pt"><span style="color:black">&lt;%</span><span style="color:blue">@</span><span style="color:black"> </span><span style="color:#a31515">Page</span><span style="color:black"> </span><span style="color:red">language</span><span style="color:blue">=&quot;C#&quot;</span><span style="color:black"> </span><span style="color:red">MasterPageFile</span><span style="color:blue">=&quot;~masterurl/default.master&quot;</span><span style="color:black"> </span><span style="color:red">Inherits</span><span style="color:blue">=&quot;ViaEcole.MyCustomFolder.EditForm&quot;</span><span style="color:black"> %&gt; </span></span></p>
<p> </p>
<p>Open the EditForm.cs and add code to override the OnLoad-method. The trick is to have a hidden property in the list definition and have the event receiver to set it after the name has been changed. The OnLoad-method checks if the property has been set. If not, the user will be redirected to the document library. </p>
<p><img alt="" src="/Lists/Photos/111109_0816_Renaminganu3.png"> </p>
<p>Add a hidden field to the list definition. </p>
<p><span style="font-family:Tahoma;font-size:10pt"><span style="color:blue">&lt;</span><span style="color:#a31515">Field</span><span style="color:blue"> </span><span style="color:red">ID</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{A3C4D5B0-E245-43f2-95D6-F3CD683224F7}</span><span style="color:black">&quot;</span><span style="color:blue"> </span><span style="color:red">Type</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">Boolean</span><span style="color:black">&quot;</span><span style="color:blue"> </span><span style="color:red">Group</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">_Hidden</span><span style="color:black">&quot;</span><span style="color:blue"> </span><span style="color:red">Name</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">SetPermission</span><span style="color:black">&quot;</span><span style="color:blue"> </span><span style="color:red">DisplaceOnUpgrade</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">TRUE</span><span style="color:black">&quot;</span><span style="color:blue"> </span><span style="color:red">SourceID</span><span style="color:blue">=</span><span style="color:black">&quot;<a href="http://schemas.microsoft.com/sharepoint/v3"></span>http://schemas.microsoft.com/sharepoint/v3<span style="color:black">&quot;</span><span style="color:blue"> </span><span style="color:red">StaticName</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">SetPermission</span><span style="color:black">&quot;</span><span style="color:blue"> </span><span style="color:red">DisplayName</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">VESetPermission</span><span style="color:black">&quot;</span><span style="color:blue"> </span><span style="color:red">XName</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">{FBF29B2D-CAE5-49aa-8E0A-29955B540122}</span><span style="color:black">&quot;</span><span style="color:blue"> </span><span style="color:red">Filterable</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">TRUE</span><span style="color:black">&quot;</span><span style="color:blue"> </span><span style="color:red">Sortable</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">TRUE</span><span style="color:black">&quot;</span><span style="color:blue"> </span><span style="color:red">Sealed</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">TRUE</span><span style="color:black">&quot;</span><span style="color:blue"> </span><span style="color:red">Hidden</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">TRUE</span><span style="color:black">&quot;</span><span style="color:blue"> </span><span style="color:red">FromBaseType</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">TRUE</span><span style="color:black">&quot;</span><span style="color:blue"> </span><span style="color:red">ReadOnly</span><span style="color:blue">=</span><span style="color:black">&quot;</span><span style="color:blue">TRUE</span><span style="color:black">&quot; /</span><span style="color:blue">&gt; </span></span></p>
<p> </p>
<p>Remember to add code to set the property PERMISSION_HAS_BEEN_SET_FIELD in the event receiver. </p>
<p>item[PERMISSION_HAS_BEEN_SET_FIELD] = true; </p>
<p>Note, this will not solve the problem when uploading a document directly from Word.</p></div></a></div>
<div><b>Category:</b> Development</div>
<div><b>Published:</b> 11/3/2009 9:19 AM</div>
]]></description>
      <author>Andreas Svensson</author>
      <category>Development</category>
      <pubDate>Wed, 11 Nov 2009 08:18:01 GMT</pubDate>
      <guid isPermaLink="true">http://blog.viaecole.se/Lists/Posts/ViewPost.aspx?ID=3</guid>
    </item>
  </channel>
</rss>
