<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>sharepoint &#8211; Kodono</title>
	<atom:link href="https://blog.kodono.info/wordpress/tag/sharepoint/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.kodono.info/wordpress</link>
	<description>Pour tous les technophiles</description>
	<lastBuildDate>Tue, 07 Nov 2023 11:09:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.2</generator>
	<item>
		<title>Search and restore an item from a SharePoint Online Recycle Bin</title>
		<link>https://blog.kodono.info/wordpress/2023/11/07/search-and-restore-an-item-from-a-sharepoint-online-recycle-bin/</link>
					<comments>https://blog.kodono.info/wordpress/2023/11/07/search-and-restore-an-item-from-a-sharepoint-online-recycle-bin/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Tue, 07 Nov 2023 11:09:37 +0000</pubDate>
				<category><![CDATA[Astuce]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Niveau expert]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=2267</guid>

					<description><![CDATA[It might be difficult to search for an item in a SharePoint recycle bin. I was using the end point _api/site/RecycleBin as a Site Collection Administrator, but in some cases it returns an error &#8220;The attempted operation is prohibited because it exceeds the list view threshold.&#8221;. The solution is to use another end point _api/site/getrecyclebinitems [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>It might be difficult to search for an item in a SharePoint recycle bin. I was using the end point <code>_api/site/RecycleBin</code> as a <b>Site Collection Administrator</b>, but in some cases it returns an error &#8220;The attempted operation is prohibited because it exceeds the list view threshold.&#8221;.</p>
<p>The solution is to use another end point <code>_api/site/getrecyclebinitems</code> (<a href="https://learn.microsoft.com/en-us/dotnet/api/microsoft.sharepoint.client.site.getrecyclebinitems?view=sharepoint-csom">see the documentation</a> for the various parameters):</p>
<pre class="brush:javascript">
fetch("https://tenant.sharepoint.com/sites/YourSite/_api/site/getrecyclebinitems?rowLimit=%2770000%27&#038;itemState=0&#038;orderby=3&#038;isAscending=false", {
  "headers": {
    "accept": "application/json",
    "content-type": "application/json",
    "x-requestdigest": document.querySelector("#__REQUESTDIGEST").value
  },
  "method": "GET",
})
.then(res => res.json())
.then(json => {
  console.log(json.value);
  // it will show an array with an object that contains several interesting properties:
  // AuthorEmail, AuthorName, DeletedByEmail, DeletedDate, DirName, Id, LeafName, Title, …
})
</pre>
<p>You can then filter the result to get what you need, for example if you&#8217;re looking for an item from the list “Projects” that has the ID 1981:</p>
<pre class="brush:javascript">
json.value.filter(item => item.DirName.includes("Lists/Projects") &#038;& item.LeafName === "1981_.000");
</pre>
<p>Then, to restore an item, we need the <code>Id</code> from the previous result. The famous endpoint to restore an item is <code>_api/site/RecycleBin('Id')/restore</code>, however it could also return the error &#8220;The attempted operation is prohibited because it exceeds the list view threshold&#8221;. In that case, we can use this other endpoint <code>_api/site/RecycleBin/RestoreByIds</code>:</p>
<pre class="brush:javascript">
fetch("https://tenant.sharepoint.com/sites/YourSite/_api/site/RecycleBin/RestoreByIds", {
  "headers": {
    "accept": "application/json",
    "content-type": "application/json",
    "x-requestdigest": document.querySelector("#__REQUESTDIGEST").value
  },
  "method": "POST",
  "body":JSON.stringify({
    "ids": [
      "4f855ee7-472b-414a-a482-4317a114c1a2" // Id to restore
    ],
    "bRenameExistingItems": true
  })
})
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2023/11/07/search-and-restore-an-item-from-a-sharepoint-online-recycle-bin/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Connect to SharePoint Online using an app clientId and clientSecret</title>
		<link>https://blog.kodono.info/wordpress/2023/03/21/connect-to-sharepoint-online-using-an-app-clientid-and-clientsecret/</link>
					<comments>https://blog.kodono.info/wordpress/2023/03/21/connect-to-sharepoint-online-using-an-app-clientid-and-clientsecret/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Tue, 21 Mar 2023 09:56:30 +0000</pubDate>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=2234</guid>

					<description><![CDATA[Get `clientId` and `clientSecret` (source) You&#8217;ll need credentials: `clientId` &#8211; required string, client id obtained when registering the addin `clientSecret` &#8211; required string, client secret obtained when registering the addin `realm` &#8211; your SharePoint Online tenant id. The easiest way to find tenant is to open SharePoint Online site collection, click Site Settings &#8594; Site [&#8230;]]]></description>
										<content:encoded><![CDATA[<h3>Get <code>`clientId`</code> and <code>`clientSecret`</code></h3>
<p>(<a href="https://github.com/s-KaiNet/node-sp-auth/wiki/SharePoint-Online-addin-only-authentication">source</a>)</p>
<p>You&#8217;ll need credentials: </p>
<ul>
<li><code>`clientId`</code> &#8211; required string, client id obtained when registering the addin</li>
<li><code>`clientSecret`</code> &#8211; required string, client secret obtained when registering the addin</li>
<li><code>`realm`</code> &#8211; your SharePoint Online tenant id. The easiest way to find tenant is to open SharePoint Online site collection, click <b>Site Settings</b> &rarr; <b>Site App Permissions</b>. Under this page you wll see at least one app &#8220;Microsoft.SharePoint&#8221;. The tenant id (realm) is highlighted in the image below:<br />
<a href="https://blog.kodono.info/wordpress/wp-content/uploads/2023/03/realm.png"><img fetchpriority="high" decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2023/03/realm-1024x183.png" alt="" width="1024" height="183" class="aligncenter size-large wp-image-2236" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2023/03/realm-1024x183.png 1024w, https://blog.kodono.info/wordpress/wp-content/uploads/2023/03/realm-300x54.png 300w, https://blog.kodono.info/wordpress/wp-content/uploads/2023/03/realm-768x137.png 768w, https://blog.kodono.info/wordpress/wp-content/uploads/2023/03/realm.png 1286w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></li>
</ul>
<p>Example of the expected result: </p>
<pre class="brush:javascript">
{
  clientId: '28bq7e56-8c3a-487d-hbfb-ef1a74539cbe',
  clientSecret: 's6LZ4VvoeKOS+MyAhklcavsyJBF4XhWo06OgY6czYJ0=',
  realm: '85e5f09b-4c17-4d80-afea-260bb171c456'
}
</pre>
<p>To get the credentials, you need to register a new addin inside SharePoint Online, by fellowing these steps:</p>
<ol>
<li>Open SharePoint Online app registration page, e.g. <code>https://contoso.sharepoint.com/sites/dev/_layouts/15/appregnew.aspx</code></li>
<li>Click on <b>&#8220;Generate&#8221;</b> for Client id and Client Secret, fill in Title, App Domain, Redirect URI (you can type in any values you want)<br />
         <a href="https://blog.kodono.info/wordpress/wp-content/uploads/2023/03/online_addinonly_reg.png"><img decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2023/03/online_addinonly_reg.png" alt="" width="374" height="364" class="aligncenter size-full wp-image-2237" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2023/03/online_addinonly_reg.png 374w, https://blog.kodono.info/wordpress/wp-content/uploads/2023/03/online_addinonly_reg-300x292.png 300w" sizes="(max-width: 374px) 100vw, 374px" /></a></li>
<li>Click on <b>&#8220;Create&#8221;</b> and save generated Client Id and Client Secret</li>
<li><strong>[IF YOU HAVE TENANT RIGHTS]</strong> Now you need to apply permissions to the newly registered app. If you want to register the app once and use it for any site collection, it&#8217;s better to apply <strong>tenant scope permissions</strong>, so you can use the credentials everywhere inside your SharePoint tenant. To apply tenant scoped permissions, open <code>AppInv.aspx</code> page under SharePoint adminstration web site, e.g. <code>https://[YOUR_ORGANIZATION]-admin.sharepoint.com/_layouts/15/appinv.aspx</code>, copy paste Client Id from step n°3 into App Id field and click <b>&#8220;Lookup&#8221;</b>.</li>
<li><strong>[IF YOU HAVE TENANT RIGHTS]</strong> You will see your registered app, paste in the following XML into the <b>&#8220;Permission Request XML&#8221;</b> field and click <b>&#8220;Create&#8221;</b>:
<pre class="rush:xml">
    &lt;AppPermissionRequests AllowAppOnlyPolicy="true">
      &lt;AppPermissionRequest Scope="http://sharepoint/content/tenant" Right="FullControl" />
    &lt;/AppPermissionRequests>
</pre>
<p><a href="https://blog.kodono.info/wordpress/wp-content/uploads/2023/03/online_addinonly_permission.png"><img decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2023/03/online_addinonly_permission.png" alt="" width="614" height="580" class="aligncenter size-full wp-image-2238" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2023/03/online_addinonly_permission.png 614w, https://blog.kodono.info/wordpress/wp-content/uploads/2023/03/online_addinonly_permission-300x283.png 300w" sizes="(max-width: 614px) 100vw, 614px" /></a></li>
<li><strong>[IF YOU ARE NOT A TENANT]</strong> If you only want to give permissions on 1 site collection, you can register the app on a regular site collection by using url <code>https://contoso.sharepoint.com/sites/dev/_layouts/15/appinv.aspx</code>. In this case you are not able to use tenant scoped permissions and can only apply site collection permissions:
<pre class="rush:xml">
    &lt;AppPermissionRequests AllowAppOnlyPolicy="true">
      &lt;AppPermissionRequest Scope="http://sharepoint/content/sitecollection" Right="FullControl" />
    &lt;/AppPermissionRequests>
</pre>
<li>You will see addin &#8220;Trust&#8221; confirmation, click on <b>&#8220;Trust It&#8221;</b>:<br />
<a href="https://blog.kodono.info/wordpress/wp-content/uploads/2023/03/online_addinonly_trust.png"><img loading="lazy" decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2023/03/online_addinonly_trust.png" alt="" width="767" height="322" class="aligncenter size-full wp-image-2239" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2023/03/online_addinonly_trust.png 767w, https://blog.kodono.info/wordpress/wp-content/uploads/2023/03/online_addinonly_trust-300x126.png 300w" sizes="auto, (max-width: 767px) 100vw, 767px" /></a><br />
 <em>if trust-it button is not enabled and you get a red label saying tenant admin needs to trust the app, go back and try again in a few minutes.</em></li>
<li>Now you can use client id and client secret to send authenticated http requests.</li>
</ol>
<p>To know more about the XML permissions, you can check the <a href="http://(see https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/add-in-permissions-in-sharepoint)">Microsoft documentation</a>.</p>
<h3>Get Access Token</h3>
<p>(you can find a <a href="https://social.technet.microsoft.com/wiki/contents/articles/51982.sharepoint-read-online-list-data-from-c-console-application-using-access-token.aspx">C# code</a> as an example)</p>
<p>You need to do a <b>POST</b> request to <code>https://accounts.accesscontrol.windows.net/[YOUR_TENANT_REALM]/tokens/OAuth/2</code> with a <b>&#8220;Content-Type&#8221;</b> header that has the value <b>&#8220;application/x-www-form-urlencoded&#8221;</b>, and the body parameters that must be:</p>
<ul>
<li>&quot;grant_type&quot;:&quot;client_credentials&quot;</li>
<li>&quot;client_id&quot;:&quot;[YOUR_CLIENT_ID]@[YOUR_TENANT_REALM]&quot;</li>
<li>&quot;client_secret&quot;:&quot;[YOUR_CLIENT_SECRET]&quot;</li>
<li>&quot;resource&quot;:&quot;00000003-0000-0ff1-ce00-000000000000/dell.sharepoint.com@[YOUR_TENANT_REALM]&quot;</li>
</ul>
<p>See below an example in PHP:</p>
<pre class=brush:php">
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://accounts.accesscontrol.windows.net/[YOUR_TENANT_REALM]/tokens/OAuth/2");
curl_setopt($curl, CURLOPT_HTTPHEADER, [ "Content-Type: application/x-www-form-urlencoded" ]);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query([
  "grant_type" => "client_credentials",
  "client_id" => "[YOUR_CLIENT_ID]@[YOUR_TENANT_REALM]",
  "client_secret" => "[YOUR_CLIENT_SECRET]",
  "resource" => "00000003-0000-0ff1-ce00-000000000000/dell.sharepoint.com@[YOUR_TENANT_REALM]"
]));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = json_decode(curl_exec($curl));
curl_close($curl);

echo $response->access_token;
</pre>
<p>The response should contain an access token. Example:</p>
<pre class="brush:javascript">
{
  "token_type":"Bearer",
  "expires_in":"86399",
  "not_before":"1679393911",
  "expires_on":"1679480611",
  "resource":"00000003-0000-0ff1-ce00-000000000000/dell.sharepoint.com@[YOUR_TENANT_REALM]",
  "access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSU[...]SxXA5Lqbk1OcOVdwQ"
}
</pre>
<p>Finally, you can do your REST API request to SharePoint Online with passing the header <b>&#8220;Authorization&#8221;</b> that has the value <b>&#8220;Bearer [YOUR_ACCESS_TOKEN]&#8221;</b>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2023/03/21/connect-to-sharepoint-online-using-an-app-clientid-and-clientsecret/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Pass an URL parameter to a SharePoint Online form&#8217;s field</title>
		<link>https://blog.kodono.info/wordpress/2022/11/30/pass-an-url-parameter-to-a-sharepoint-online-forms-field/</link>
					<comments>https://blog.kodono.info/wordpress/2022/11/30/pass-an-url-parameter-to-a-sharepoint-online-forms-field/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Wed, 30 Nov 2022 08:43:25 +0000</pubDate>
				<category><![CDATA[Debug]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Niveau expert]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=2170</guid>

					<description><![CDATA[The only way to pass a URL parameter to a SharePoint Online (modern design) form&#8217;s field is to use PowerApps (at least, if you cannot add any JS on your website!). Important warning: when you use PowerApps to manage your form, all edits to the list settings won&#8217;t reflect to the PowerApps form. For example, [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>The only way to pass a URL parameter to a SharePoint Online (modern design) form&#8217;s field is to use PowerApps (at least, if you cannot add any JS on your website!).</p>
<p><b style="color:red">Important warning</b>: when you use PowerApps to manage your form, all edits to the list settings won&#8217;t reflect to the PowerApps form. For example, if you add a field, it won&#8217;t show up, and you&#8217;ll have to manually update the PowerApps to add it (see at the bottom of this article).</p>
<p>From the list view, go to <code>Integrate</code> then <code>PowerApps</code> and <code>Customize forms</code>:<br />
<a href="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/integrate.png"><img loading="lazy" decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/integrate.png" alt="" width="931" height="161" class="aligncenter size-full wp-image-2172" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/integrate.png 931w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/integrate-300x52.png 300w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/integrate-768x133.png 768w" sizes="auto, (max-width: 931px) 100vw, 931px" /></a></p>
<p>Once PowerApps has open the form, you need to do several things.</p>
<h2>1. Load the ID</h2>
<p>We first need to make sure the form will load the required item when we pass the <code>ID</code> URL parameter:<br />
<a href="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/form_mode_item.png"><img loading="lazy" decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/form_mode_item-1024x442.png" alt="" width="1024" height="442" class="aligncenter size-large wp-image-2175" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/form_mode_item-1024x442.png 1024w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/form_mode_item-300x130.png 300w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/form_mode_item-768x332.png 768w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/form_mode_item-1536x663.png 1536w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/form_mode_item.png 1899w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>From the <b>SharepointForm Advanced Settings</b>, we change the <b>DefaultMode</b> to check if we have the <code>ID</code> parameter, and if we don&#8217;t have it, then it should be a New Form, otherwise an Edit Form:</p>
<pre class="brush:powershell">If(IsBlank(Param("ID")), FormMode.New, FormMode.Edit)</pre>
<p>From the <b>SharepointForm Advanced Settings</b>, we change the <b>Item</b> section to check if we have the <code>ID</code> parameter, and if we have it, then we do a lookup in our list to find the data:</p>
<pre class="brush:powershell">If(IsBlank(Param("ID")), SharePointIntegration.Selected, LookUp('NAME OF THE LIST', ID = Value(Param("ID"))))</pre>
<h2>Add a SUBMIT button</h2>
<p>With PowerApps, there is no button to save the changes! We&#8217;ll add a button in the form:<br />
<a href="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/save_btn.png"><img loading="lazy" decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/save_btn-1024x274.png" alt="" width="1024" height="274" class="aligncenter size-large wp-image-2178" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/save_btn-1024x274.png 1024w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/save_btn-300x80.png 300w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/save_btn-768x206.png 768w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/save_btn-1536x411.png 1536w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/save_btn.png 1898w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>In the button&#8217;s properties, we change the <b>onSelect</b> to be:</p>
<pre class="brush:powershell">SubmitForm(SharePointForm1)</pre>
<p>Be aware that the page will stay with the form after clicking on the button. You could want to close using the <a href="https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-exit">Exit()</a> function, but the user will be redirected on office.com … I&#8217;d recommend to use <a href="https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-param">Launch()</a> by redirecting your users to a page:</p>
<pre class="brush:powershell">SubmitForm(SharePointForm1); Launch("https://tenant.sharepoint.com/sites/MySite/");</pre>
<h2>Set field&#8217;s value based on URL parameter</h2>
<p>We can finally set the field&#8217;s value based on the parameter in the URL. Select the INPUT zone of the field, and in the <b>Default</b> section we use the below formula:</p>
<pre class="brush:powershell">If(IsBlank(Param("Title")), ThisItem.Title, Param("Title"))</pre>
<p><a href="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/title_value.png"><img loading="lazy" decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/title_value-1024x281.png" alt="" width="1024" height="281" class="aligncenter size-large wp-image-2179" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/title_value-1024x281.png 1024w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/title_value-300x82.png 300w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/title_value-768x211.png 768w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/title_value-1536x422.png 1536w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/title_value.png 1903w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Here my field is called &#8220;Title&#8221; so I decided to use a parameter called &#8220;Title&#8221; as well.</p>
<h2>Link to the form</h2>
<p>We cannot use the <b>NewForm.aspx</b> or <b>EditForm.aspx</b> to access this form, but we need a special link.</p>
<p>Go to your <b>list settings</b>:<br />
<a href="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/list_settings.png"><img loading="lazy" decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/list_settings.png" alt="" width="934" height="363" class="aligncenter size-full wp-image-2180" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/list_settings.png 934w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/list_settings-300x117.png 300w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/list_settings-768x298.png 768w" sizes="auto, (max-width: 934px) 100vw, 934px" /></a></p>
<p>Then go to the <b>form settings</b> (it&#8217;s from there that you can decide to keep PowerApps or use the original Sharepoint Forms), and click on <b>See versions and usage</b>:<br />
<a href="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/form_settings.png"><img loading="lazy" decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/form_settings.png" alt="" width="980" height="274" class="aligncenter size-full wp-image-2181" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/form_settings.png 980w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/form_settings-300x84.png 300w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/form_settings-768x215.png 768w" sizes="auto, (max-width: 980px) 100vw, 980px" /></a></p>
<p>You&#8217;ll get the <b>App Id</b> from this page:<br />
<a href="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/app_id.png"><img loading="lazy" decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/app_id.png" alt="" width="273" height="166" class="aligncenter size-full wp-image-2182" /></a></p>
<p>Next, you&#8217;ll use the <b>App Id</b> to forge the URL: <b>https://apps.powerapps.com/play/providers/Microsoft.PowerApps/apps/APP_ID</b><br />
With our example, the URL will be: <a href="https://apps.powerapps.com/play/providers/Microsoft.PowerApps/apps/c6f23ac1-dcbd-4daf-925e-2701ab241ca0">https://apps.powerapps.com/play/providers/Microsoft.PowerApps/apps/c6f23ac1-dcbd-4daf-925e-2701ab241ca0</a></p>
<p>You can now pass the URL parameter: <b>https://apps.powerapps.com/play/providers/Microsoft.PowerApps/apps/APP_ID?Title=Hello%20World</b><br />
And an ID to retrieve an existing item: <b>https://apps.powerapps.com/play/providers/Microsoft.PowerApps/apps/APP_ID?Title=Hello%20World&#038;ID=2</b></p>
<h2>How to use it with a LookUp column?</h2>
<p>If you want to auto-select a LookUp field using an URL parameter, you need to do a few things…</p>
<p>First, we need to add the related table. To do so, click on <b>Data</b> in the left navigation bar and search for <b>SharePoint</b>:<br />
<a href="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/datasource_sharepoint.png"><img loading="lazy" decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/datasource_sharepoint.png" alt="" width="351" height="512" class="aligncenter size-full wp-image-2188" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/datasource_sharepoint.png 351w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/datasource_sharepoint-206x300.png 206w" sizes="auto, (max-width: 351px) 100vw, 351px" /></a></p>
<p>Search for the table and add it.</p>
<p>Second (optional) step: click on the Lookup field in the form and change the <b>Items</b> to show a list of options – if no &#8220;Lookup&#8221; ID in the URL, then we use the default list of options:<br />
<a href="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/items_options.png"><img loading="lazy" decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/items_options-1024x218.png" alt="" width="1024" height="218" class="aligncenter size-large wp-image-2192" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/items_options-1024x218.png 1024w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/items_options-300x64.png 300w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/items_options-768x163.png 768w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/items_options-1536x327.png 1536w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/items_options.png 1898w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>The below formula permits to retrieve the &#8220;ID&#8221; and &#8220;Title&#8221; from the distant list, base on the &#8220;Lookup&#8221; parameter, and to rename the result as <code>{Id:"ID", Value:"Title"}</code>:</p>
<pre class="brush:powershell">If(IsBlank(Param("Lookup")), Choices([@'CURRENT LIST NAME'].COLUMN_NAME), RenameColumns(ShowColumns(Filter('DISTANT LIST NAME', ID = Value(Param("Lookup"))), "ID", "Title"), "ID", "Id", "Title", "Value"))</pre>
<p>Third, click on the Lookup field in the form and change the <b>DefaultSelectedItems</b> to select the item from the list of options:<br />
<a href="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/default_selected_items.png"><img loading="lazy" decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/default_selected_items-1024x204.png" alt="" width="1024" height="204" class="aligncenter size-large wp-image-2193" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/default_selected_items-1024x204.png 1024w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/default_selected_items-300x60.png 300w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/default_selected_items-768x153.png 768w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/default_selected_items-1536x307.png 1536w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/default_selected_items.png 1898w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>The below formula returns an empty selection with <code>{Id:"", Value:""}</code> when no URL param, otherwise it returns the first record for our lookup:</p>
<pre class="brush:plain">If(IsBlank(Param("Lookup")), {Id:"", Value:""}, First(RenameColumns(ShowColumns(Filter('DISTANT LIST NAME', ID = Value(Param("Lookup"))), "ID", "Title"), "ID", "Id", "Title", "Value")))</pre>
<p>And finally, we can pass <b>Lookup=ID</b> in the URL to select the related item in the other list</p>
<h2>How to deal with new fields?</h2>
<p>If you add a new field to your list&#8217;s settings, you&#8217;ll have to edit the form in PowerApps, and then edit the fields and add the new one:<br />
<a href="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/add_field.png"><img loading="lazy" decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/add_field-1024x239.png" alt="" width="1024" height="239" class="aligncenter size-large wp-image-2197" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/add_field-1024x239.png 1024w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/add_field-300x70.png 300w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/add_field-768x179.png 768w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/add_field-1536x359.png 1536w, https://blog.kodono.info/wordpress/wp-content/uploads/2022/11/add_field.png 1906w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>(I used <a href="https://www.about365.nl/2020/08/06/passing-parameters-to-your-power-apps-sharepoint-form/">this article</a> as a starting point)</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2022/11/30/pass-an-url-parameter-to-a-sharepoint-online-forms-field/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Microsoft Sharepoint Migration Tool that works behind a proxy</title>
		<link>https://blog.kodono.info/wordpress/2021/05/06/microsoft-sharepoint-migration-tool-that-works-behind-a-proxy/</link>
					<comments>https://blog.kodono.info/wordpress/2021/05/06/microsoft-sharepoint-migration-tool-that-works-behind-a-proxy/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Thu, 06 May 2021 08:16:57 +0000</pubDate>
				<category><![CDATA[Debug]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=2079</guid>

					<description><![CDATA[It looks like the newer version of the Microsoft Sharepoint Migration Tool doesn&#8217;t accept to work behind a corporate network. A colleague has an older version (april 2020) that works correctly. Here is the link to download this version: SharepointMigrationToolSetup_April2020]]></description>
										<content:encoded><![CDATA[<p>It looks like the newer version of the <a href="https://docs.microsoft.com/en-us/sharepointmigration/introducing-the-sharepoint-migration-tool">Microsoft Sharepoint Migration Tool</a> doesn&#8217;t accept to work behind a corporate network.</p>
<p>A colleague has an older version (april 2020) that works correctly. Here is the link to download this version: <a href="https://blog.kodono.info/wordpress/wp-content/uploads/2021/05/SharepointMigrationToolSetup_April2020.zip">SharepointMigrationToolSetup_April2020</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2021/05/06/microsoft-sharepoint-migration-tool-that-works-behind-a-proxy/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Access to Sharepoint Online with Windows Explorer</title>
		<link>https://blog.kodono.info/wordpress/2021/05/06/access-to-sharepoint-online-with-windows-explorer/</link>
					<comments>https://blog.kodono.info/wordpress/2021/05/06/access-to-sharepoint-online-with-windows-explorer/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Thu, 06 May 2021 07:21:03 +0000</pubDate>
				<category><![CDATA[Astuce]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Niveau débutant]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=2071</guid>

					<description><![CDATA[If you want to access your Sharepoint online (https://[tenant].sharepoint.com), you first need to make sure the site is in the Trusted Website in Internet Explorer. Open Internet Explorer, navigate to the website, then open the Internet Options: Add your website to the Trusted Website zone: Next open Windows Explorer and right-click on &#8220;Your PC &#8220;, [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>If you want to access your Sharepoint online (https://[tenant].sharepoint.com), you first need to make sure the site is in the Trusted Website in Internet Explorer.<br />
<strong>Open Internet Explorer</strong>, navigate to the website, then open the <strong>Internet Options</strong>:<br />
<img loading="lazy" decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2021/05/internet_options1.png" alt="" width="421" height="354" class="aligncenter size-full wp-image-2072" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2021/05/internet_options1.png 421w, https://blog.kodono.info/wordpress/wp-content/uploads/2021/05/internet_options1-300x252.png 300w" sizes="auto, (max-width: 421px) 100vw, 421px" /></p>
<p>Add your website to the <strong>Trusted Website zone</strong>:<br />
<img loading="lazy" decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2021/05/internet_options2.png" alt="" width="482" height="272" class="aligncenter size-large wp-image-2073" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2021/05/internet_options2.png 482w, https://blog.kodono.info/wordpress/wp-content/uploads/2021/05/internet_options2-300x169.png 300w" sizes="auto, (max-width: 482px) 100vw, 482px" /></p>
<p>Next open Windows Explorer and <strong>right-click on &#8220;Your PC &#8220;, then select &#8220;Map network drive…&#8221;</strong>:<br />
<img loading="lazy" decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2021/05/network1.png" alt="" width="413" height="330" class="aligncenter size-full wp-image-2074" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2021/05/network1.png 413w, https://blog.kodono.info/wordpress/wp-content/uploads/2021/05/network1-300x240.png 300w" sizes="auto, (max-width: 413px) 100vw, 413px" /></p>
<p>You need to use a special path to your website. Let&#8217;s say your website is located at <a href="https://tenant.sharepoint.com/sites/Marketing">https://tenant.sharepoint.com/sites/Marketing</a> then the path to use is:<br />
<b>\\tenant.sharepoint.com@ssl\DavWWWRoot\sites\Marketing\</b></p>
<p>Note the <code>@ssl</code> and <code>DavWWWRoot</code> that are required.</p>
<p>Assign this path to a drive letter:<br />
<img loading="lazy" decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2021/05/network2.png" alt="" width="614" height="455" class="aligncenter size-full wp-image-2077" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2021/05/network2.png 614w, https://blog.kodono.info/wordpress/wp-content/uploads/2021/05/network2-300x222.png 300w" sizes="auto, (max-width: 614px) 100vw, 614px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2021/05/06/access-to-sharepoint-online-with-windows-explorer/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Sharepoint error message &#8220;Invalid URL argument&#8221; with WebPartPages</title>
		<link>https://blog.kodono.info/wordpress/2019/11/29/sharepoint-error-message-invalid-url-argument-with-webpartpages/</link>
					<comments>https://blog.kodono.info/wordpress/2019/11/29/sharepoint-error-message-invalid-url-argument-with-webpartpages/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Fri, 29 Nov 2019 17:10:07 +0000</pubDate>
				<category><![CDATA[Astuce]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=2005</guid>

					<description><![CDATA[For me the issue was this part of the XML request: &#60;AddWebPart xmlns='http://microsoft.com/sharepoint/webpartpages/'&#62; (with a / at the end of the url) instead of &#60;AddWebPart xmlns='http://microsoft.com/sharepoint/webpartpages'&#62;.]]></description>
										<content:encoded><![CDATA[<p>For me the issue was this part of the XML request: <code>&lt;AddWebPart xmlns='http://microsoft.com/sharepoint/webpartpages/'&gt;</code> (with a <code>/</code> at the end of the url) instead of <code>&lt;AddWebPart xmlns='http://microsoft.com/sharepoint/webpartpages'&gt;</code>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2019/11/29/sharepoint-error-message-invalid-url-argument-with-webpartpages/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Sharepoint REST API to index a column or delete a column and more&#8230;</title>
		<link>https://blog.kodono.info/wordpress/2019/08/19/sharepoint-rest-api-to-index-a-column-or-delete-a-column-and-more/</link>
					<comments>https://blog.kodono.info/wordpress/2019/08/19/sharepoint-rest-api-to-index-a-column-or-delete-a-column-and-more/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Mon, 19 Aug 2019 09:16:50 +0000</pubDate>
				<category><![CDATA[Astuce]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Niveau expert]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=1979</guid>

					<description><![CDATA[Due to the 5,000 items threshold limitation it can become very frustrating to administrate Sharepoint. For example, if your list has more than 5,000 items, you cannot add an index, delete a lookup/people column, delete the list or the website, and more ! Hopefully some of the operations can be done with REST API, and [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Due to the 5,000 items threshold limitation it can become very frustrating to administrate Sharepoint. For example, if your list has more than 5,000 items, you cannot add an index, delete a lookup/people column, delete the list or the website, and more !</p>
<p>Hopefully some of the operations can be done with REST API, and in my organization the threshold limitation is removed during the night (1am to 4am). By combining a schedule service (like <a href="https://github.com/node-schedule/node-schedule">node-schedule</a>) with my library <a href="https://aymkdn.github.io/SharepointPlus/">SharepointPlus</a> I can run this admin tasks during the night while my virtual computer is running.</p>
<h2>To delete a column</h2>
<pre class="brush:javascript">
$SP().ajax({
  url:"https://company.com/sharepoint/team/sales/_api/web/lists/getbytitle('My List')/fields/getbytitle('Column To Delete')",
  method: "POST",
  headers: {
    "IF-MATCH": "*",
    "X-HTTP-Method": "DELETE"
  }
});
</pre>
<h2>To index a column</h2>
<pre class="brush:javascript">
$SP().ajax({
  url:"https://company.com/sharepoint/team/sales/_api/web/lists/getbytitle('My List')/fields/getbytitle('Column to Index')",
  method: "POST",
  body:JSON.stringify({
    "__metadata":{ type: "SP.Field" },
    "Indexed":true
  }),
  headers: {
    "IF-MATCH": "*",
    "X-HTTP-Method": "MERGE"
  }
})
</pre>
<h2>To delete a list</h2>
<pre class="brush:javascript">
$SP().ajax({
  url:"https://company.com/sharepoint/team/sales/_api/web/lists/getbytitle('List To Delete')",
  method: "POST",
  headers: {
    "IF-MATCH": "*",
    "X-HTTP-Method": "DELETE"
  }
})
</pre>
<h2>To delete a list</h2>
<pre class="brush:javascript">
$SP().ajax({
  url:"https://company.com/sharepoint/team/sales/_api/web/lists/getbytitle('List To Delete')",
  method: "POST",
  headers: {
    "IF-MATCH": "*",
    "X-HTTP-Method": "DELETE"
  }
})
</pre>
<h2>To delete a site</h2>
<pre class="brush:javascript">
$SP().ajax({
  url:"https://company.com/sharepoint/team/sales/website_to_delete/_api/web/",
  method: "POST",
  headers: {
    "X-HTTP-Method": "DELETE"
  }
})
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2019/08/19/sharepoint-rest-api-to-index-a-column-or-delete-a-column-and-more/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>SharePoint 2013 Search REST API options</title>
		<link>https://blog.kodono.info/wordpress/2019/07/24/sharepoint-2013-search-rest-api-options/</link>
					<comments>https://blog.kodono.info/wordpress/2019/07/24/sharepoint-2013-search-rest-api-options/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Wed, 24 Jul 2019 08:23:37 +0000</pubDate>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=1973</guid>

					<description><![CDATA[Finding the documentation for the Search REST API of Sharepoint is difficult&#8230;. There is a very old blog post that I&#8217;m going to replicate here to give more visibility: &#160; Location of the Search Rest service The Search REST service is located at the following URI: http://host/site/_api/search &#160; The Search REST API The Search REST [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Finding the documentation for the Search REST API of Sharepoint is difficult&#8230;. There is a very <a href="https://blogs.msdn.microsoft.com/nadeemis/2012/08/24/sharepoint-2013-search-rest-api/">old blog post</a> that I&#8217;m going to replicate here to give more visibility:</p>
<p>&nbsp;</p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;"><strong><span style="text-decoration: underline;">Location of the Search Rest service</span></strong></p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;">The Search REST service is located at the following URI: <a href="http://host/site/_api/search">http://host/site/_api/search</a></p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;">&nbsp;</p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;"><strong><span style="text-decoration: underline;">The Search REST API</span></strong></p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;">The Search REST service exposed by the URI specified above provides the following methods or entry points:</p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;">&nbsp;</p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;">&nbsp;</p>
<div style="direction: ltr;">
<table style="border: 1pt solid #a3a3a3; margin-left: 0.333in; border-collapse: collapse; direction: ltr;" valign="top" cellspacing="0" cellpadding="0" border="1">
<tbody>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; width: 0.837in; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;"><span style="font-weight: bold;">query</span></p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; width: 2.709in; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;"><a href="http://host/site/_api/search/query">http://host/site/_api/search/query</a></p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; width: 8.953in; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;">Supports HTTP Get&nbsp;and is used to retrieve search results.</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; width: 0.837in; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;"><span style="font-weight: bold;">postquery</span></p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; width: 2.709in; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;"><a href="http://host/site/_api/search/postquery">http://host/site/_api/search/postquery</a></p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; width: 8.953in; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;">Supports HTTP POST and is used to retrieve search results. This method can be used to overcome URI length restrictions when using the HTTP GET based method &#8220;<span style="font-weight: bold;">query</span>&#8220;.</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; width: 0.837in; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;"><span style="font-weight: bold;">suggest</span></p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; width: 2.709in; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;"><a href="http://host/site/_api/search/suggest">http://host/site/_api/search/suggest</a></p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; width: 8.953in; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;">Supports HTTP GET and is used to retrieve query suggestions.</p>
</td>
</tr>
</tbody>
</table>
</div>
<p style="margin: 0in 0in 0in 0.375in; font-family: Calibri; font-size: 11pt;">&nbsp;</p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;"><strong><span style="text-decoration: underline;">Query Parameters</span></strong></p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;">The following table lists the query parameters available for the <span style="font-weight: bold;">query </span>entry point:</p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;">&nbsp;</p>
<div>
<table style="border: 1pt solid #a3a3a3; margin-left: 0.133in; border-collapse: collapse; direction: ltr;" valign="top" cellspacing="0" cellpadding="0" border="1">
<tbody>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; width: 0.837in; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;"><span style="font-weight: bold;">Name</span></p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; width: 0.837in; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;"><span style="font-weight: bold;">Description</span></p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; width: 0.837in; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;"><span style="font-weight: bold;">Type</span></p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; width: 0.837in; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;"><span style="font-weight: bold;">Default</span></p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">querytext</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">The text of the&nbsp;search query.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">String &#8211; Maximum query text length allowed by the Keyword Query OM is 4096 characters.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 8pt;">Empty</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/query?querytext=&#8217;search is cool&#8217;</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">querytemplate</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">The query template text.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">String</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 8pt;">Empty</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4">&nbsp;</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">enableinterleaving</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Specifies if the result sets which are generated by executing query rule actions to add result&nbsp; block should be mixed with the result set for the original query.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">bool</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 8pt;">True</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/query?querytext=&#8217;terms&#8217;&amp;enableinterleaving=false</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">sourceid</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Specifies the&nbsp;unique identifier of the Result Source to use for executing the search query.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">String</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 8pt;">Empty</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/query?querytext=&#8217;term&#8217;&amp;sourceid=&#8217;8413cd39-2156-4e00-b54d-11efd9abdb89&#8242;</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">rankingmodelid</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">The GUID of the Rank Model to be used for this search query.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">String</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 8pt;">Empty</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4">&nbsp;</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">startrow</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">A zero-based index of the first search result to be returned.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Integer [ &gt;= 0]</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 8pt;">0</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/query?querytext=&#8217;terms&#8217;&amp;startrow=11</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">rowlimit</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">The maximum number of search results to be returned, starting at the index specified in&nbsp; startrow.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Integer&nbsp;[ &gt;= 0]</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 8pt;">10</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/query?querytext=&#8217;terms&#8217;&amp;startrow=11&amp;rowlimit=3</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">rowsperpage</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">The number of&nbsp;results to return per page.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Integer&nbsp;[ &gt;= 0]</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 8pt;">0</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4">&nbsp;</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">selectproperties</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Specifies the list of managed properties to return for each search result item. For a managed property to be returned; the Retrievable flag must be set to &#8220;true&#8221; in the Search Schema.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">String</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 8pt;">Empty</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/query?querytext=&#8217;terms&#8217;&amp;selectproperties=&#8217;Path,Url,Title,Author&#8217;</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">culture</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Specifies the identifier of the language culture of the search query. If present, the value must be a valid LCID of a culture name. A list of LCIDs is available <a href="http://msdn.microsoft.com/en-us/goglobal/bb964664.aspx">here</a>.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Integer</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 8pt;">-1</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/query?querytext=&#8217;terms&#8217;&amp;culture=1044</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">refiners</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Specifies a list of refiners to return as a comma-separated list of strings.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">String</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 8pt;">Empty</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/query?querytext=&#8217;terms&#8217;&amp;refiners=&#8217;companies,contentclass,ContentType,FileExtension,FileType&#8217;</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">refinementfilters</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">The list of refinement tokens for drilldown into search results. Refinement tokens are returned as part of the RefinementResults table for the search query.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">String</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Empty</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/query?querytext=&#8217;sharepoint&#8217;&amp;refiners=&#8217;filetype&#8217;&amp;refinementfilters=&#8217;filetype:equals(&#8220;pptx&#8221;)&#8217;</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">hiddenconstraints</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Specifies additional query terms that will be appended to the query.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">String</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Empty</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/query?querytext=&#8217;terms&#8217;&amp;hiddenconstraints=&#8217;powerpoint&#8217;</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">sortlist</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Specifies the list of properties to sort the search results by.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">String</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Empty</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/query?querytext=&#8217;terms&#8217;&amp;sortlist=&#8217;rank:ascending&#8217;</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">enablestemming</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Specifies whether stemming is enabled for the query.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">bool</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">True</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/query?querytext=&#8217;terms&#8217;&amp;enablestemming=false</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">trimduplicates</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Specifies whether duplicate items should be removed from search results. This property can also<br />&nbsp;be used to collapse hits in the result set.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">bool</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">True</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/query?querytext=&#8217;terms&#8217;&amp;trimduplicates=false</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">trimduplicatesincludeid</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Specifies the value associated with a collapse group, typically used when a user clicks the duplicates link of an item with duplicates.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">long</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">0L</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/query?querytext=&#8217;terms&#8217;&amp;trimduplicates=true&amp;trimduplicatesincludeid=47</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">timeout</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Specifies the amount of time, in milliseconds, before the query request times out.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Integer</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">30000</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/query?querytext=&#8217;terms&#8217;&amp;timeout=50000</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">enablenicknames</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Specifies whether the exact terms in the search query are used to find matches, or if nicknames<br />&nbsp;are used as well.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">bool</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">False</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/query?querytext=&#8217;terms&#8217;&amp;enablenicknames=true</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">enablephonetic</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Specifies whether the phonetic forms of the query terms are used to find matches.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">bool</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">False</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/query?querytext=&#8217;terms&#8217;&amp;enablephonetic=true</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">enablefql</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Specifies whether the query string is according to the FAST Query Language (FQL) syntax.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Bool</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">False</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/query?querytext=&#8217;terms&#8217;&amp;enablefql=true</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">hithighlightedproperties</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Specifies the list of properties to include in the HitHighlightedProperties for each result item.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">String</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Empty</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/query?querytext=&#8217;terms&#8217;&amp;hithighlightedproperties=&#8217;Title,Author&#8217;</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">bypassresulttypes</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Specifies if the search result item type should be returned for the query results.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">bool</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">False</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4">&nbsp;</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">processbestbets</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Specifies if the search promoted results should be returned, if available, as a result set.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">bool</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">True</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4">&nbsp;</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">clienttype</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Name of a client which issued query.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">String</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Empty</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4">&nbsp;</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">personalizationdata</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Gets or sets the unique identifier (GUID) for the current user who submitted the search query.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">String</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Empty</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4">&nbsp;</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">resultsurl</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Specifies the URL for the page where the search results are going to be displayed.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">String</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Empty</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4">&nbsp;</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">querytag</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Any custom tags to be used to identify the query. Multiple tags are separated by semicolons.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">String</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Empty</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4">&nbsp;</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">enablequeryrules</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Specifies if Query Rules are turned on for this query.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">bool</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">True</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/query?querytext=&#8217;terms&#8217;&amp;enablequeryrules=false</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">enablesorting</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Indicates whether results should be sorted.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">bool</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">True</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/query?querytext=&#8217;terms&#8217;&amp;enablesorting=false</span></td>
</tr>
</tbody>
</table>
</div>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;">&nbsp;</p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;">&nbsp;</p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;"><strong><span style="text-decoration: underline;">Suggest Parameters</span></strong></p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;">The following table lists the query parameters available from the suggest entry point:</p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;">&nbsp;&nbsp;</p>
<div style="direction: ltr;">
<table style="border: 1pt solid #a3a3a3; margin-left: 0.133in; border-collapse: collapse; direction: ltr;" valign="top" cellspacing="0" cellpadding="0" border="1">
<tbody>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; width: 0.837in; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;"><span style="font-weight: bold;">Name</span></p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;"><span style="font-weight: bold;">Description</span></p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; width: 0.837in; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;"><span style="font-weight: bold;">Type</span></p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; width: 0.837in; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;"><span style="font-weight: bold;">Default</span></p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">querytext</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">The text of the search query.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">String</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Empty</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/suggest?querytext=&#8217;nad&#8217;</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">inumberofquerysuggestions</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">The number of query suggestions to retrieve.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Integer&nbsp;[ &gt; 0]</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">5</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/suggest?querytext=&#8217;nad&#8217;&amp;inumberofquerysuggestions=6</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">inumberofresultsuggestions</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">The number of personal results to retrieve.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Integer&nbsp;[ &gt; 0]</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">5</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/suggest?querytext=&#8217;nad&#8217;&amp;inumberofresultsuggestions=6</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">fprequerysuggestions</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Specifies whether to retrieve pre-query suggestions or post-query suggestions.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">bool</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">False</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/suggest?querytext=&#8217;nad&#8217;&amp;fprequerysuggestions=true</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">fhithighlighting</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Specifies whether the query suggestions should be highlighted. If &#8220;true&#8221;, the terms<br />&nbsp;in the returned query suggestions that match terms in the specified query are&nbsp; surrounded with &lt;B&gt; and &lt;/B&gt; HTML tags.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">bool</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">True</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/suggest?querytext=&#8217;nad&#8217;&amp;fhithighlighting=true</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">fcapitalizefirstletters</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Specifies whether to capitalize first letters in each term in query suggestions.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">bool</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">False</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/suggest?querytext=&#8217;nad&#8217;&amp;fcapitalizefirstletters=true</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">showpeoplenamesuggestions</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Specifies if people names should be included in query suggestions.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">bool</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">False</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/suggest?querytext=&#8217;nad&#8217;&amp;showpeoplenamesuggestions=true</span></td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">culture</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Specifies the identifier of the language culture of the search query. If present, the value must be a valid LCID of a culture name. A nice list of LCIDs is available <a href="http://msdn.microsoft.com/en-us/goglobal/bb964664.aspx">here</a>.</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">Integer</p>
</td>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top;">
<p style="margin: 0in; font-family: Calibri; font-size: 9pt;">-1</p>
</td>
</tr>
<tr>
<td style="padding: 4pt; border: 1pt solid #a3a3a3; vertical-align: top; padding-bottom: 8pt;" colspan="4"><span style="color: #5499b9; text-decoration: underline;">http://host/site/_api/search/suggest?querytext=&#8217;nad&#8217;&amp;culture=1044</span></td>
</tr>
</tbody>
</table>
</div>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;">&nbsp;</p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;">&nbsp;</p>
<p style="margin: 0in; font-family: Calibri; font-size: 11pt;">&nbsp;References:</p>
<ul>
<li>
<div style="margin: 0in; font-family: Calibri; font-size: 11pt;"><a href="http://msdn.microsoft.com/en-us/library/hh659202(office.12).aspx">[MS-SRCHCSOM]: Search Client Query Protocol Specification</a></div>
</li>
<li>
<div style="margin: 0in; font-family: Calibri; font-size: 11pt;"><a href="http://msdn.microsoft.com/en-us/library/jj163300(office.15).aspx">Search in SharePoint 2013 on MSDN</a></div>
</li>
</ul>
<h2>Examples</h2>
<p>A <code>postquery</code> request will look like:</p>
<pre class="brush">
POST http://localhost/_api/search/postquery HTTP/1.1
Accept: application/json;odata=verbose
Content-Type: application/json;odata=verbose
Host: localhost
Content-Length: 419

{

 'request': {
     'Querytext': 'sharepoint',
     'StartRow':1,
     'RowLimit':8,
     'SelectProperties': {
          'results': ['Title','ContentSource','DisplayAuthor']
     },
     'TrimDuplicates':true,
     'Refiners':'companies,contentclass,ContentType(filter=7/0/*),FileExtension(filter=7/0/*),FileType(filter=6/0/*)',
     'RefinementFilters': {'results': ['filetype:equals("pptx")'] }
  }
}
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2019/07/24/sharepoint-2013-search-rest-api-options/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>SP.Utilities.Utility.SendEmail returns &#8220;The e-mail message cannot be sent. Make sure the e-mail has a valid recipient.&#8221;</title>
		<link>https://blog.kodono.info/wordpress/2019/06/28/sp-utilities-utility-sendemail-returns-the-e-mail-message-cannot-be-sent-make-sure-the-e-mail-has-a-valid-recipient/</link>
					<comments>https://blog.kodono.info/wordpress/2019/06/28/sp-utilities-utility-sendemail-returns-the-e-mail-message-cannot-be-sent-make-sure-the-e-mail-has-a-valid-recipient/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Fri, 28 Jun 2019 14:01:58 +0000</pubDate>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Niveau débutant]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=1967</guid>

					<description><![CDATA[With Sharepoint you can use SP.Utilities.Utility.SendEmail to send email in JavaScript, however you could receive the below error: &#8220;The e-mail message cannot be sent. Make sure the e-mail has a valid recipient.&#8221; After searching the web, I found the solution: instead of using an email address for the recipients you have to use the userDomain [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>With Sharepoint you can use <a href="https://gist.github.com/BasantPandey/05189832546f2c6cc0bd008fcfec3264">SP.Utilities.Utility.SendEmail</a> to send email in JavaScript, however you could receive the below error:</p>
<blockquote><p>
&#8220;The e-mail message cannot be sent. Make sure the e-mail has a valid recipient.&#8221;
</p></blockquote>
<p>After searching the web, I found <a href="http://sadomovalex.blogspot.com/2015/08/one-of-reasons-of-why-sending-email-via.html">the solution</a>: <b>instead of using an email address for the recipients</b> you have to use the <b>userDomain with &#8220;i:0#.w|&#8221;</b>.</p>
<p>For example, if the user is John Doe, and his email is john_doe@company.com, then you should use something like <b>i:0#.w|domain\\john_doe</b>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2019/06/28/sp-utilities-utility-sendemail-returns-the-e-mail-message-cannot-be-sent-make-sure-the-e-mail-has-a-valid-recipient/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Sharepoint DateRangesOverlap value</title>
		<link>https://blog.kodono.info/wordpress/2018/07/09/sharepoint-daterangesoverlap-value/</link>
					<comments>https://blog.kodono.info/wordpress/2018/07/09/sharepoint-daterangesoverlap-value/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Mon, 09 Jul 2018 09:33:19 +0000</pubDate>
				<category><![CDATA[English]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=1904</guid>

					<description><![CDATA[(this is a copy of a post that is not available anymore) DateRangesOverlap Value Type I don&#8217;t know if any back-end developers have run into this same issue when working with the SPQuery to pull expanded recurrence date, but from here, not all DateRangesOverlap Value types work the way they should. And they&#8217;re cryptically-documented, where [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>(this is a copy of a <a href="https://web.archive.org/web/20120506114811/https://www.nothingbutsharepoint.com/sites/eusp/Pages/Use-SPServices-to-Get-Recurring-Events-as-Distinct-Items.aspx">post</a> that is not available anymore)</p>
<p><strong>DateRangesOverlap Value Type</strong></p>
<p>I don&#8217;t know if any back-end developers have run into this same issue when working with the SPQuery to pull expanded recurrence date, but from here, not all DateRangesOverlap Value types work the way they should. And they&#8217;re cryptically-documented, where mentioned at all. The basics are that you can return dates that &#8220;overlap&#8221; a given scenario. The overlapping varies depending on scenario, as follows:</p>
<p><strong>&lt;Year /></strong><br />
This is supposed to get all events within:<br />
(a) Today&#8217;s year (if no CalendarDate is passed), or<br />
(b) the date passed in QueryOptions as CalendarDate.</p>
<p>Actually, it returns all dates from [Today] into the future. It ignores:<br />
(a) the CalendarDate, and<br />
(b) the end of the current year</p>
<p><strong>&lt;Month /></strong><br />
Performs consistently as expected, with the exception that its definition of &#8220;month&#8221; is more of a &#8220;month view.&#8221; A month view consists of all of the weeks which contain days in that month. In other words, the month view for May 2012 begins on April 29, 2012, because May 1 is on a Tuesday and the &#8220;month view&#8221; consists of full weeks. Likewise, the May 2012 month view ends on June 5, 2012. This means that pulling all of the dates for May 2012 will return all events for April 29 &#8211; June 5.</p>
<p>However, even though April 29 is the beginning of the May month view, when passed as the CalendarDate, it will return the April month view. See below for how this affects date calculations based on pulling data for a given month.</p>
<p><strong>&lt;Week /></strong><br />
Performs exactly like &lt;Month />, but only returns the corresponding week for:<br />
(a) Today, or<br />
(b) CalendarDate</p>
<p><strong>&lt;Today /></strong><br />
Returns just the events for Today.</p>
<p><strong>&lt;Now /></strong><br />
Contrary to most documentation, &lt;Now /> doesn&#8217;t &#8220;work&#8221; but rather defaults to the same results as &lt;Year />.</p>
<p>In fact, &lt;Year /> is the default. If you leave off the entire WHERE clause, but include the RecurrenceDate and fRecurrence fields and the QueryOptions (CalendarDate will be ignored), you get the same results as &lt;Year />.</p>
<p><strong>CalendarDate</strong></p>
<p>In QueryOptions, if the CalendarDate is set, it needs the date to be a string in the format:<br />
            <code>yyyy-mm-ddThh:mm:ssZ</code></p>
<p>In most cases, setting the CalendarDatewhen needed to the real date on which you want to base your range will work just fine, as long as you set the time in the Z-notation to noon. The reason for the noontime setting is to make allowance for all-day events within the given range. These tend to get messed up when viewing is based on a midnight or early morning time. Basing the range on noon alleviates the issue. (At least it does for US time zones; I confess that I haven&#8217;t tested them all.) </p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2018/07/09/sharepoint-daterangesoverlap-value/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to delete a document locked by another user in Sharepoint using JavaScript</title>
		<link>https://blog.kodono.info/wordpress/2017/11/20/how-to-delete-a-document-locked-by-another-user-in-sharepoint-using-javascript/</link>
					<comments>https://blog.kodono.info/wordpress/2017/11/20/how-to-delete-a-document-locked-by-another-user-in-sharepoint-using-javascript/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Mon, 20 Nov 2017 10:37:03 +0000</pubDate>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Niveau expert]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=1862</guid>

					<description><![CDATA[When you open a file from Sharepoint, it will receive a short term lock that will prevent others to change some properties on the file. This protection can be useful, but also very annoying, for example when the file is not closed properly, then the lock could stay &#8220;forever&#8221;. There are many posts on the [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>When you open a file from Sharepoint, it will receive a short term lock that will prevent others to change some properties on the file.</p>
<p>This protection can be useful, but also very annoying, for example when the file is not closed properly, then the lock could stay &#8220;forever&#8221;.</p>
<p>There are <a href="https://sharepoint.stackexchange.com/questions/42999/clearing-short-term-file-lock">many</a> <a href="https://sharepoint.stackexchange.com/questions/120246/how-to-delete-a-document-locked-by-another-user-im-a-super-admin">posts</a> <a href="https://sharepoint.stackexchange.com/questions/165970/can-we-unlock-a-shortterm-lock-via-csom-for-sp2013">on</a> <a href="https://sharepoint.stackexchange.com/questions/202665/the-file-is-locked-for-exclusive-use-by-same-person-sharepoint-online">the web</a> about it.</p>
<p>I found one that has been super useful: <a href="https://pholpar.wordpress.com/2014/04/07/how-to-use-javascript-to-delete-short-term-locks-from-documents-opened-from-sharepoint/">https://pholpar.wordpress.com/2014/04/07/how-to-use-javascript-to-delete-short-term-locks-from-documents-opened-from-sharepoint/</a><br />
The author explains very well the different steps what I&#8217;m trying to summarize:</p>
<ol>
<li>Send a request to <code>_vti_bin/_vti_aut/author.dll</code> with special headers/body</li>
<li>Auth.dll will provide the <code>lockid</code></li>
<li>Send a request to <code>_vti_bin/cellstorage.svc/CellStorageService</code> with special headers/body, included the <code>lockid</code></li>
<li>The file is unlocked</li>
</ol>
<p>The code to send to CellStorageService, and provided by the author, didn&#8217;t work for me. I&#8217;ve had to use Fiddler and open the document into Office on my computer to see the kind of requests send by it to unlock a document. Based on it, I&#8217;ve re-built the code and you can find my solution below.</p>
<p>Tested on Sharepoint 2013 On-Promise only. I don&#8217;t know if this solution works for Sharepoint Online or other version.<br />
Also note that I use <code>$SP().ajax()</code> from <a href="https://aymkdn.github.io/SharepointPlus/">SharepointPlus</a>, but it&#8217;s equivalent to the <code>$.ajax</code> from jQuery.</p>
<pre class="brush:javascript">
// full path to the document
var docUrl = "https://website.com/website/Doc_Library/Test.docx";

// start by querying author.dll to find the lockid and the user who locked it
$SP().ajax({
  url: 'https://website.com/website/_vti_bin/_vti_aut/author.dll',
  headers:{
    "Content-Type": "application/x-www-form-urlencoded",
    "MIME-Version": "1.0",
    "Accept": "auth/sicily",
    "X-Vermeer-Content-Type": "application/x-www-form-urlencoded"
  },
  body: 'method=getDocsMetaInfo%3a14%2e0%2e0%2e6009&#038;url%5flist=%5b' + encodeURIComponent(docUrl) + '%5d&#038;listHiddenDocs=false&#038;listLinkInfo=false',
}).then(function(source) {
  // go thru the source page returned to find the lockid and current user
  var nextLine = false;
  var ret = { "lockid":"", "user":"", when:"" };
  source.split("\n").forEach(function(line) {
    if (line.indexOf("vti_sourcecontrollockid") !== -1) nextLine="lockid"; // vti_sourcecontrollockid -> the lockid to use later
    else if (line.indexOf("vti_sourcecontrolcheckedoutby") !== -1) nextLine="user"; // vti_sourcecontrolcheckedoutby -> username of the user who locked it
    else if (line.indexOf("vti_sourcecontrollockexpires") !== -1) nextLine="when"; // vti_sourcecontrollockexpires -> when the server is supposed to unlock it
    else if (nextLine !== false) {
      ret[nextLine] = line.slice(7).replace(/&#([0-9]|[1-9][0-9]|[[01][0-9][0-9]|2[0-4][0-9]|25[0-5]);/g, function (str, match) { return  String.fromCharCode(match); });
      nextLine = false;
    }
  });

  if (!ret.lockid) { alert("Not Locked") }
  else {
    // compose a request based on what Microsoft Office sends to the Sharepoint server
    // found using Fiddler
    var releaseLockReq = '&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">&lt;s:Body>&lt;RequestVersion Version="2" MinorVersion="2" xmlns="http://schemas.microsoft.com/sharepoint/soap/"/>&lt;RequestCollection CorrelationId="{96A244BD-D13B-4696-9355-231FB673BC4F}" xmlns="http://schemas.microsoft.com/sharepoint/soap/">&lt;Request Url="'+docUrl+'" UseResourceID="true" UserAgent="{1984108C-4B93-4EEB-B320-919432D6E593}" UserAgentClient="msword" UserAgentPlatform="win" Build="16.0.8201.2102" MetaData="1031" RequestToken="1">&lt;SubRequest Type="ExclusiveLock" SubRequestToken="1">&lt;SubRequestData ExclusiveLockRequestType="ReleaseLock" ExclusiveLockID="'+ret.lockid+'"/>&lt;/SubRequest>&lt;/Request>&lt;/RequestCollection>&lt;/s:Body>&lt;/s:Envelope>';

    // we send it to the webservice cellstorage.svc
    $SP().ajax({
      url:'https://website.com/website/_vti_bin/cellstorage.svc/CellStorageService',
      body:releaseLockReq,
      headers:{
        'Content-Type':'text/xml; charset=UTF-8',
        'SOAPAction': "http://schemas.microsoft.com/sharepoint/soap/ICellStorages/ExecuteCellStorageRequest"
      }
    })
    .then(function(res) {
      if (res.indexOf('ErrorCode="Success"') !== -1) alert("Success") // the file has been unlocked
      else alert("Failed")
    })
  }
})
</pre>
<p>I hope it will be useful to someone else!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2017/11/20/how-to-delete-a-document-locked-by-another-user-in-sharepoint-using-javascript/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Sharepoint WopiFrame allow framing</title>
		<link>https://blog.kodono.info/wordpress/2017/07/25/sharepoint-wopiframe-allow-framing/</link>
					<comments>https://blog.kodono.info/wordpress/2017/07/25/sharepoint-wopiframe-allow-framing/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Tue, 25 Jul 2017 09:17:56 +0000</pubDate>
				<category><![CDATA[Astuce]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Niveau intermédiaire]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=1832</guid>

					<description><![CDATA[In Sharepoint you can use &#60;WebPartPages:AllowFraming runat="server" /> to disable the SAMEORIGIN for X-FRAME-OPTION giving you the opportunity to call your page from an iframe (see this other article). However you cannot use the same trick to preview a file into the browser with WopiFrame.aspx. But there is a way to do it, using the [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In Sharepoint you can use <code>&lt;WebPartPages:AllowFraming runat="server" /></code> to disable the SAMEORIGIN for X-FRAME-OPTION giving you the opportunity to call your page from an iframe (see <a href="https://blog.kodono.info/wordpress/2016/11/08/disable-x-frame-options-on-sharepoint/">this other article</a>).</p>
<p>However you cannot use the same trick to preview a file into the browser with <code>WopiFrame.aspx</code>. But there is a way to do it, using the parameters into the URL.</p>
<p>Let&#8217;s say the url to preview your document is:<br />
<strong>https://my.company.com/sharepoint/_layouts/15/WopiFrame.aspx?sourcedoc=/files/Demo.docx&#038;action=default</strong></p>
<p>You need to replace <code>action=default</code> with <code>action=embedview</code>, AND you need to call <code>WopiFrame2.aspx</code> instead of <code>WopiFrame.aspx</code> (which will lead to a <code>Something Went Wrong - Sorry, you don't have access to this page</code>).</p>
<p>So the URL to use for your iframe will be:<br />
<strong>https://my.company.com/sharepoint/_layouts/15/WopiFrame2.aspx?sourcedoc=/files/Demo.docx&#038;action=embedview</strong></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2017/07/25/sharepoint-wopiframe-allow-framing/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Change a &#8220;Choice with Fill-In&#8221; field into a magic dropdown [Sharepoint]</title>
		<link>https://blog.kodono.info/wordpress/2017/07/19/change-a-choice-with-fill-in-field-into-a-magic-dropdown-sharepoint/</link>
					<comments>https://blog.kodono.info/wordpress/2017/07/19/change-a-choice-with-fill-in-field-into-a-magic-dropdown-sharepoint/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Wed, 19 Jul 2017 15:45:48 +0000</pubDate>
				<category><![CDATA[Astuce]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Niveau intermédiaire]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=1826</guid>

					<description><![CDATA[Sometimes you want to modify the options for a dropdown box by removing some existing options, however you want to be able to keep these old values for reporting or whatever reasons. Below is a way to do it by using jQuery and SharepointPlus. It will hide the &#8220;Specify your own value&#8221; stuff, and add [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Sometimes you want to modify the options for a dropdown box by removing some existing options, however you want to be able to keep these old values for reporting or whatever reasons.</p>
<p>Below is a way to do it by using jQuery and <a href="https://aymkdn.github.io/SharepointPlus/">SharepointPlus</a>. It will hide the &#8220;Specify your own value&#8221; stuff, and add the old value (if any) into the dropdown selection.</p>
<p>For example if you have a Choice field with options &#8220;A&#8221;, &#8220;B&#8221;, &#8220;C&#8221;. Your item ID #1 has value &#8220;B&#8221;.<br />
After a while you decide to delete &#8220;B&#8221; and add &#8220;D&#8221;, but you want to be able to find items with the &#8220;B&#8221; value.<br />
So you choose &#8220;Choice with Fill-In&#8221; and apply the below code:</p>
<pre class="brush:javascript">
// For flexibility reasons we create them as a Choice with Fill-In option,
//    however we hide the free text field and we show only the dropdown
//    in case of the fill-in has a value, then we add it into the list of options
$SP().formfields(["My Fist Dropdown", "Another One"]).each(function() {
  var $e = this.elem();
  // hide all except the dropdown
  //$e.not('select').hide().filter(':radio:last').closest('tr').hide(); // SP2010
  $e.eq(0).closest('table').find('tr:gt(0)').hide(); // SP2013
  // if we have a value into the fill-in box, then:
  //   - add it into the options
  //   - when another value is selected we check the first checkbox
  var fillValue = $e.last().val();
  if (fillValue) {
    $e.filter('select').append('&lt;option data-fillin="true">'+fillValue+'&lt;/option>').each(function() {
      var $this=$(this);
      $this.find('option:last').prop("selected", true);
      $this.removeAttr("onclick").on('change', function(event) {
        var $opt = $(this).find(':selected');
        if ($opt.data("fillin")) {
          $e.filter(':radio:last').prop("checked", true);
        } else {
          $e.filter(':radio:first').prop("checked", true);
        }
      });
    });
  }
})
</pre>
<p>So now, if you create a new item you&#8217;ll see a dropdown with &#8220;A&#8221;, &#8220;C&#8221;, and &#8220;D&#8221; only.<br />
But if you edit your item #1, you&#8217;ll have a dropdown with &#8220;A&#8221;, &#8220;C&#8221;, &#8220;D&#8221; and &#8220;B&#8221;.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2017/07/19/change-a-choice-with-fill-in-field-into-a-magic-dropdown-sharepoint/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Trigger an event when a file is uploaded on Sharepoint 2013 by drag and drop</title>
		<link>https://blog.kodono.info/wordpress/2017/06/23/trigger-an-event-when-a-file-is-uploaded-on-sharepoint-2013-by-drag-and-drop/</link>
					<comments>https://blog.kodono.info/wordpress/2017/06/23/trigger-an-event-when-a-file-is-uploaded-on-sharepoint-2013-by-drag-and-drop/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Fri, 23 Jun 2017 10:32:08 +0000</pubDate>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Niveau intermédiaire]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=1817</guid>

					<description><![CDATA[If you want to trigger an event after a drag&#038;drop a file for an upload operation on Sharepoint, then you&#8217;ll have to add some JavaScript into your page. // we need to make sure sp.core.js is loaded SP.SOD.executeOrDelayUntilScriptLoaded(function() { window.UploadFinishFunc=function(b, a) { typeof g_currentControl.postUploadFunc == "function" &#038;&#038; a.status != UploadStatus.CANCELLED &#038;&#038; g_currentControl.postUploadFunc(a.files); a.status != UploadStatus.CANCELLED [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>If you want to trigger an event after a drag&#038;drop a file for an upload operation on Sharepoint, then you&#8217;ll have to add some JavaScript into your page.</p>
<pre class="brush:javascript">
// we need to make sure sp.core.js is loaded
SP.SOD.executeOrDelayUntilScriptLoaded(function() {
  window.UploadFinishFunc=function(b, a) {
    typeof g_currentControl.postUploadFunc == "function" &#038;& a.status != UploadStatus.CANCELLED &#038;& g_currentControl.postUploadFunc(a.files);
    a.status != UploadStatus.CANCELLED &#038;& myPostUploadFunc(a);
    g_currentControl.status = ControlStatus.UPLOADED;
    UpdateProgressBar(ProgressMessage.UPLOADED, a);
    RefreshResult(a);
    g_currentControl.status = ControlStatus.IDLE
  }
}, 'sp.core.js');
SP.SOD.executeFunc('sp.core.js')

// below is the function that will be called
function myPostUploadFunc(data) {
  console.log("myPostUploadFunc => ",data)
}
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2017/06/23/trigger-an-event-when-a-file-is-uploaded-on-sharepoint-2013-by-drag-and-drop/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Adding a custom action to a callout in SharePoint 2013</title>
		<link>https://blog.kodono.info/wordpress/2017/06/21/adding-a-custom-action-to-a-callout-in-sharepoint-2013/</link>
					<comments>https://blog.kodono.info/wordpress/2017/06/21/adding-a-custom-action-to-a-callout-in-sharepoint-2013/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Wed, 21 Jun 2017 15:15:03 +0000</pubDate>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Niveau intermédiaire]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[Astuce]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=1814</guid>

					<description><![CDATA[This article has been VERY useful. But I wanted something lightly different: I wanted to add a custom action, but also have the &#8220;EDIT&#8221; button (but not the &#8220;SHARE&#8221;), and to use the current item info for my custom action. Here is the result: // source: https://www.eliostruyf.com/adding-a-custom-action-to-a-callout-in-sharepoint-2013/ // add a special callout action for our [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>This <a href="https://www.eliostruyf.com/adding-a-custom-action-to-a-callout-in-sharepoint-2013/">article</a> has been VERY useful. But I wanted something lightly different: I wanted to add a custom action, but also have the &#8220;EDIT&#8221; button (but not the &#8220;SHARE&#8221;), and to use the current item info for my custom action.</p>
<p>Here is the result:</p>
<pre class="brush:javascript">
// source: https://www.eliostruyf.com/adding-a-custom-action-to-a-callout-in-sharepoint-2013/
// add a special callout action for our library
SP.SOD.executeFunc("callout.js", "Callout", function () {
  var itemCtx = {};
  itemCtx.Templates = {};
  itemCtx.BaseViewID = 'Callout';
  // Define the list template type
  itemCtx.ListTemplateType = 101;
  itemCtx.Templates.Footer = function (itemCtx) {
    // context, custom action function, show the ECB menu (boolean)
    return CalloutRenderFooterTemplate(itemCtx, AddCustomAction, true);
  };
  SPClientTemplates.TemplateManager.RegisterTemplateOverrides(itemCtx);
});

function AddCustomAction (renderCtx, calloutActionMenu) {
  var itemIndex = renderCtx.CurrentItemIdx
  // Add your custom action
  calloutActionMenu.addAction(new CalloutAction ({
    text: "Custom Action",
    tooltip: 'This is your custom action',
    onClickCallback: function() {
      // all the data related to your item are into `renderCtx.ListData.Row[itemIndex]`
      console.log('Callback from custom action');
    }
  }));
  // re-add EDIT action
  calloutActionMenu.addAction(new CalloutAction ({
    text: "Edit",
    onClickCallback: function(event) {
      // use the default action we have when clicking on the filename into the library
      // or call the EditForm if it's a list item and not a library
      DispEx(this, event,'TRUE','FALSE','FALSE','SharePoint.OpenDocuments.3','1','SharePoint.OpenDocuments','','1https://your.sharepoint.com/_layouts/15/WopiFrame.aspx?sourcedoc='+renderCtx.ListData.Row[itemIndex].FileRef+'&#038;action=default','','1','0','0','0x7fffffffffffffff')
    }
  }));
}
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2017/06/21/adding-a-custom-action-to-a-callout-in-sharepoint-2013/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Sharepoint Callout Documentation</title>
		<link>https://blog.kodono.info/wordpress/2017/06/19/sharepoint-callout-documentation/</link>
					<comments>https://blog.kodono.info/wordpress/2017/06/19/sharepoint-callout-documentation/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Mon, 19 Jun 2017 14:47:40 +0000</pubDate>
				<category><![CDATA[À bookmarker]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Niveau débutant]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=1812</guid>

					<description><![CDATA[It&#8217;s difficult to find the JavaScript documentation for the Sharepoint Callout popup&#8230; So there is the link for a quick reference: https://msdn.microsoft.com/en-us/library/office/dn135236%28v=office.15%29.aspx]]></description>
										<content:encoded><![CDATA[<p>It&#8217;s difficult to find the JavaScript documentation for the Sharepoint Callout popup&#8230; So there is the link for a quick reference: <a href="https://msdn.microsoft.com/en-us/library/office/dn135236%28v=office.15%29.aspx">https://msdn.microsoft.com/en-us/library/office/dn135236%28v=office.15%29.aspx</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2017/06/19/sharepoint-callout-documentation/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to hide the left navigation bar in Sharepoint without CSS</title>
		<link>https://blog.kodono.info/wordpress/2017/06/15/how-to-hide-the-left-navigation-bar-in-sharepoint-without-css/</link>
					<comments>https://blog.kodono.info/wordpress/2017/06/15/how-to-hide-the-left-navigation-bar-in-sharepoint-without-css/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Thu, 15 Jun 2017 12:47:19 +0000</pubDate>
				<category><![CDATA[Astuce]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Niveau débutant]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=1810</guid>

					<description><![CDATA[We can easily find some workarounds to hide the left navigation bar on Sharepoint using CSS&#8230;. But I wanted to remove it on a specific page, without using any CSS. It&#8217;s actually pretty simple. You need to add the below tag into your .aspx page: &#60;asp:Content ContentPlaceHolderID="PlaceHolderLeftNavBar" runat="Server">&#60;/asp:Content> Tested with Sharepoint 2013 On-Promise.]]></description>
										<content:encoded><![CDATA[<p>We can easily find some workarounds to hide the left navigation bar on Sharepoint using CSS&#8230;. But I wanted to remove it on a specific page, without using any CSS.</p>
<p>It&#8217;s actually pretty simple. You need to add the below tag into your .aspx page:</p>
<pre class="brush:html">
&lt;asp:Content ContentPlaceHolderID="PlaceHolderLeftNavBar" runat="Server">&lt;/asp:Content>
</pre>
<p>Tested with Sharepoint 2013 On-Promise.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2017/06/15/how-to-hide-the-left-navigation-bar-in-sharepoint-without-css/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to cache the CSS Fonts with Sharepoint</title>
		<link>https://blog.kodono.info/wordpress/2017/06/15/how-to-cache-the-css-fonts-with-sharepoint/</link>
					<comments>https://blog.kodono.info/wordpress/2017/06/15/how-to-cache-the-css-fonts-with-sharepoint/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Thu, 15 Jun 2017 09:36:20 +0000</pubDate>
				<category><![CDATA[Astuce]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Niveau débutant]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=1807</guid>

					<description><![CDATA[If you use your own CSS file with your own CSS fonts, then we&#8217;ll notice that Sharepoint doesn&#8217;t send cache headers if you use the below CSS code: @font-face { font-family: 'Roboto'; src: url('/_catalogs/masterpage/css/fonts/Roboto/Regular/Roboto-Regular.woff2') format('woff2'), url('/_catalogs/masterpage/css/fonts/Roboto/Regular/Roboto-Regular.woff') format('woff'), url('/_catalogs/masterpage/css/fonts/Roboto/Regular/Roboto-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; } To have this resource sent back from the Sharepoint server with [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>If you use your own CSS file with your own CSS fonts, then we&#8217;ll notice that Sharepoint doesn&#8217;t send cache headers if you use the below CSS code:</p>
<pre class="brush:css">
@font-face {
  font-family: 'Roboto';
  src: url('/_catalogs/masterpage/css/fonts/Roboto/Regular/Roboto-Regular.woff2') format('woff2'),
       url('/_catalogs/masterpage/css/fonts/Roboto/Regular/Roboto-Regular.woff') format('woff'),
       url('/_catalogs/masterpage/css/fonts/Roboto/Regular/Roboto-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
}
</pre>
<p>To have this resource sent back from the Sharepoint server with cache headers, you just need to add <code>?ctag=0</code> at the end:</p>
<pre class="brush:css">
@font-face {
  font-family: 'Roboto';
  src: url('/_catalogs/masterpage/css/fonts/Roboto/Regular/Roboto-Regular.woff2?ctag=0') format('woff2'),
       url('/_catalogs/masterpage/css/fonts/Roboto/Regular/Roboto-Regular.woff?ctag=0') format('woff'),
       url('/_catalogs/masterpage/css/fonts/Roboto/Regular/Roboto-Regular.ttf?ctag=0') format('truetype');
  font-weight: 400;
  font-style: normal;
}
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2017/06/15/how-to-cache-the-css-fonts-with-sharepoint/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Sharepoint CallOut Popup</title>
		<link>https://blog.kodono.info/wordpress/2017/06/14/sharepoint-callout-popup/</link>
					<comments>https://blog.kodono.info/wordpress/2017/06/14/sharepoint-callout-popup/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Wed, 14 Jun 2017 15:46:29 +0000</pubDate>
				<category><![CDATA[À bookmarker]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Niveau intermédiaire]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=1805</guid>

					<description><![CDATA[You can find the documentation of the cool Sharepoint CallOut Popup on dev.office.com: https://dev.office.com/sharepoint/docs/sp-add-ins/highlight-content-and-enhance-the-functionality-of-sharepoint-hosted-sharepoint]]></description>
										<content:encoded><![CDATA[<p>You can find the documentation of the cool Sharepoint CallOut Popup on dev.office.com: <a href="https://dev.office.com/sharepoint/docs/sp-add-ins/highlight-content-and-enhance-the-functionality-of-sharepoint-hosted-sharepoint">https://dev.office.com/sharepoint/docs/sp-add-ins/highlight-content-and-enhance-the-functionality-of-sharepoint-hosted-sharepoint</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2017/06/14/sharepoint-callout-popup/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Create an Unpublished Content view for the masterpage galery [Sharepoint]</title>
		<link>https://blog.kodono.info/wordpress/2017/05/18/create-an-unpublished-content-view-for-the-masterpage-galery-sharepoint/</link>
					<comments>https://blog.kodono.info/wordpress/2017/05/18/create-an-unpublished-content-view-for-the-masterpage-galery-sharepoint/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Thu, 18 May 2017 13:38:16 +0000</pubDate>
				<category><![CDATA[Astuce]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Niveau expert]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=1792</guid>

					<description><![CDATA[With Sharepoint 2013 I wanted an easy way to list of the pages in my masterpage galery that haven&#8217;t been published yet. You first need to Create a new view named Unpublished Content. You can sort by Name, and scroll down to the Folders settings and choose Show all items without folders. We now have [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>With Sharepoint 2013 I wanted an easy way to list of the pages in my masterpage galery that haven&#8217;t been published yet.</p>
<p>You first need to <strong>Create a new view</strong> named <strong>Unpublished Content</strong>. You can <strong>sort by Name</strong>, and scroll down to the <strong>Folders settings</strong> and choose <strong>Show all items without folders</strong>.</p>
<p>We now have all our files in the view.</p>
<p>Next, switch to the <strong>Library ribbon</strong> and choose <strong>Modify in SharePoint Designer (Advanced)</strong> from the <strong>Modify View dropdown</strong>.</p>
<p>Sharepoint Designer will open your page.</p>
<p>In Sharepoint Designer, switch to the </strong>Home</strong> tab and choose <strong>Advanced Mode</strong>. The file is reloaded.</p>
<p>Search into your code the tag <strong>ListViewXml</strong>. On this line you should have <strong>&amp;lt;Query;&#038;&amp;gt;</strong>. Just after it, we need to add:<br />
<code>&amp;lt;Where&amp;gt;&amp;lt;Or&amp;gt;&amp;lt;Eq&amp;gt;&amp;lt;FieldRef Name="_ModerationStatus" /&amp;gt;&amp;lt;Value Type="ModStat"&amp;gt;Draft&amp;lt;/Value&amp;gt;&amp;lt;/Eq&amp;gt;&amp;lt;IsNotNull&amp;gt;&amp;lt;FieldRef Name="CheckoutUser" /&amp;gt;&amp;lt;/IsNotNull&amp;gt;&amp;lt;/Or&amp;gt;&amp;lt;/Where&amp;gt;</code></p>
<p>Before:<br />
<img loading="lazy" decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2017/05/unpublished1-1024x127.png" alt="" width="1024" height="127" class="aligncenter size-large wp-image-1793" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2017/05/unpublished1-1024x127.png 1024w, https://blog.kodono.info/wordpress/wp-content/uploads/2017/05/unpublished1-300x37.png 300w, https://blog.kodono.info/wordpress/wp-content/uploads/2017/05/unpublished1-768x95.png 768w, https://blog.kodono.info/wordpress/wp-content/uploads/2017/05/unpublished1.png 1121w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><br />
After:<br />
<a href="https://blog.kodono.info/wordpress/wp-content/uploads/2017/05/unpublished2.png" target="_blank"><img loading="lazy" decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2017/05/unpublished2-1024x68.png" alt="" width="1024" height="68" class="aligncenter size-large wp-image-1794" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2017/05/unpublished2-1024x68.png 1024w, https://blog.kodono.info/wordpress/wp-content/uploads/2017/05/unpublished2-300x20.png 300w, https://blog.kodono.info/wordpress/wp-content/uploads/2017/05/unpublished2-768x51.png 768w, https://blog.kodono.info/wordpress/wp-content/uploads/2017/05/unpublished2.png 1714w" sizes="auto, (max-width: 1024px) 100vw, 1024px" />(click to enlarge)</a></p>
<p>Save, and your view should only show the unpublished content!</p>
<p>(Article inspired by <a href="https://thechriskent.com/2013/02/14/unpublished-view/">https://thechriskent.com/2013/02/14/unpublished-view/</a>)</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2017/05/18/create-an-unpublished-content-view-for-the-masterpage-galery-sharepoint/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Check permissions in Sharepoint based on a PermMask</title>
		<link>https://blog.kodono.info/wordpress/2017/04/06/check-permissions-in-sharepoint-based-on-a-permmask/</link>
					<comments>https://blog.kodono.info/wordpress/2017/04/06/check-permissions-in-sharepoint-based-on-a-permmask/#comments</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Thu, 06 Apr 2017 12:41:34 +0000</pubDate>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Niveau intermédiaire]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=1773</guid>

					<description><![CDATA[In some cases you could get this kind of hexadecimal numbers from Sharepoint for the PermMask: 0xb008431061, or 0x1b03c4313ff, and so on. To verify the PermMask against the different level of permissions you can proceed with the below method (using functions from core.js): var permMask = '0x1b03c4313ff'; var permissions = new SP.BasePermissions(); permissions.initPropertiesFromJson({High:GetPermMaskH(permMask), Low:GetPermMaskL(permMask)}); // [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>In some cases you could get this kind of hexadecimal numbers from Sharepoint for the PermMask: <code>0xb008431061</code>, or <code>0x1b03c4313ff</code>, and so on.</p>
<p>To verify the PermMask against the different level of permissions you can proceed with the below method (using functions from <code>core.js</code>):</p>
<pre class="brush:javascript">
var permMask = '0x1b03c4313ff';
var permissions = new SP.BasePermissions();
permissions.initPropertiesFromJson({High:GetPermMaskH(permMask), Low:GetPermMaskL(permMask)});
// we can now check permissions using SP.BasePermissions.has()
// and we can compare with SP.PermissionKind — see https://msdn.microsoft.com/en-us/library/office/ee556747(v=office.14).aspx
var canEdit = permissions.has(SP.PermissionKind.editListItems);
</pre>
<p>On Sharepoint 2010 <code>GetPermMaskH</code> and <code>GetPermMaskL</code> are not defined, so here is their code:</p>
<pre class="brush:javascript">
function GetPermMaskH(b) {
    var a = b.length;
    return a &lt;= 10 ? 0 : parseInt(b.substring(2, a - 8), 16)
}

function GetPermMaskL(b) {
    var a = b.length;
    return a &lt;= 10 ? parseInt(b) : parseInt(b.substring(a - 8, a), 16)
}
</pre>
<p>It took me many hours to find how to proceed, so I hope it will help some others.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2017/04/06/check-permissions-in-sharepoint-based-on-a-permmask/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Decode Sharepoint unicode URL</title>
		<link>https://blog.kodono.info/wordpress/2017/02/17/decode-sharepoint-unicode-url/</link>
					<comments>https://blog.kodono.info/wordpress/2017/02/17/decode-sharepoint-unicode-url/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Fri, 17 Feb 2017 10:32:31 +0000</pubDate>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Niveau intermédiaire]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=1770</guid>

					<description><![CDATA[Sharepoint encodes the URLs with unicode, so we&#8217;ll see many \u002f to represent /. If you want to decode those unicode strings, you can use this short code: unescape(JSON.parse('"' + s.replace('"', '\\"') + '"'))]]></description>
										<content:encoded><![CDATA[<p>Sharepoint encodes the URLs with unicode, so we&#8217;ll see many <code>\u002f</code> to represent <code>/</code>.</p>
<p>If you want to decode those unicode strings, you can use <a href="http://stackoverflow.com/a/12869914/1134119">this short code</a>:<br />
<code>unescape(JSON.parse('"' + s.replace('"', '\\"') + '"'))</code></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2017/02/17/decode-sharepoint-unicode-url/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Redirect after Deleting [Sharepoint]</title>
		<link>https://blog.kodono.info/wordpress/2017/02/15/redirect-after-deleting-sharepoint/</link>
					<comments>https://blog.kodono.info/wordpress/2017/02/15/redirect-after-deleting-sharepoint/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Wed, 15 Feb 2017 15:42:15 +0000</pubDate>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Niveau intermédiaire]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=1768</guid>

					<description><![CDATA[When I open a dialog for an EditFrom and use the &#8220;Delete Item&#8221; button from the ribbon, then the main page is redirected to the related Sharepoint list. This behavior is very bad for the user experience. To change it I used the below Javascript code: // replace the Delete Item default action when into [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>When I open a dialog for an EditFrom and use the &#8220;Delete Item&#8221; button from the ribbon, then the main page is redirected to the related Sharepoint list. This behavior is very bad for the user experience.</p>
<p>To change it I used the below Javascript code:</p>
<pre class="brush:javascript">
// replace the Delete Item default action when into a popup
$(document).ready(function() {
  // if it's in a popup
  if (window !== window.top) {
    $('a[id$="_toolBarTbl_RptControls_diidIODeleteItem"]').attr("href","javascript:commonDeleteItem(); return false")
  }
})
// now when clicking on the Delete item it will call my own function
// here I use http://aymkdn.github.io/SharepointPlus/ to show a waiting message and to delete the current item, and then close the modal
function commonDeleteItem() {
  $SP().waitModalDialog("Deleting...");
  $SP().list("{"+WPQ2FormCtx.ListAttributes.Id+"}").remove({ID:GetUrlKeyValue("ID")}, {
    after:function() {
      $SP().closeModalDialog();
      $SP().closeModalDialog(2);
    }
  })
}
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2017/02/15/redirect-after-deleting-sharepoint/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to open an Excel document from SharePoint into Chrome/Firefox in readonly/edit mode</title>
		<link>https://blog.kodono.info/wordpress/2017/02/09/how-to-open-an-excel-document-from-sharepoint-files-into-chromefirefox-in-readonlyedit-mode/</link>
					<comments>https://blog.kodono.info/wordpress/2017/02/09/how-to-open-an-excel-document-from-sharepoint-files-into-chromefirefox-in-readonlyedit-mode/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Thu, 09 Feb 2017 18:07:22 +0000</pubDate>
				<category><![CDATA[Debug]]></category>
		<category><![CDATA[Navigateur]]></category>
		<category><![CDATA[Niveau intermédiaire]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=1760</guid>

					<description><![CDATA[With Sharepoint 2010, when you use Internet Explorer you can open an Office document in readonly or in edit mode. Also, when trying to open an Excel file in Firefox/Chrome it will probably open the ugly xslviewer and won&#8217;t let you deal with your file. After searching a bit about it, I found a clue [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>With Sharepoint 2010, when you use Internet Explorer you can open an Office document in readonly or in edit mode. Also, when trying to open an Excel file in Firefox/Chrome it will probably open the ugly <code>xslviewer</code> and won&#8217;t let you deal with your file.</p>
<p>After searching a bit about it, I found <a href="http://stackoverflow.com/a/30929451/1134119">a clue</a> that helped me to find a good solution: on Firefox/Chrome when you click on an Excel file, you&#8217;ll now have a modal asking if you want to open it in edit or readonly mode!<br />
<img loading="lazy" decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2017/02/opendocuments1.png" alt="" width="310" height="298" class="aligncenter size-full wp-image-1761" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2017/02/opendocuments1.png 310w, https://blog.kodono.info/wordpress/wp-content/uploads/2017/02/opendocuments1-300x288.png 300w" sizes="auto, (max-width: 310px) 100vw, 310px" /></p>
<p>To achieve this result you have to insert the below Javascript code somewhere into your masterpage:</p>
<pre class="brush:javascript">
/**
 * fix problem with Excel documents on Firefox/Chrome
 * @param  {HTMLElement} p the &lt;A> element
 * @param  {HTMLEvent} a the click event
 * @param  {Boolean} h TRUE
 * @param  {Boolean} e FALSE
 * @param  {Boolean} g FALSE
 * @param  {Strin} k the ActiveX command (e.g. "SharePoint.OpenDocuments.3")
 * @param  {Number} c 0
 * @param  {String} o the activeX command, here we look at "SharePoint.OpenDocuments"
 * @param  {String} m
 * @param  {String} b the replacement URL to the xslviewer
 */
var bak_DispEx;
var modalOpenDocument; // it will be use with the modal
SP.SOD.executeOrDelayUntilEventNotified(function() {
  bak_DispEx = _DispEx;
  _DispEx=function(p, a, h, e, g, k, c, o, m, b, j, l, i, f, d) {
    // if o==="SharePoint.OpenDocuments" &#038;& !IsClientAppInstalled(o)
    // in that case we want to open ask the user if he/she wants to readonly or edit the file
    var fileURL = b.replace(/.*_layouts\/xlviewer\.aspx\?id=(.*)/, "$1");
    if (o === "SharePoint.OpenDocuments" &#038;& !IsClientAppInstalled(o) &#038;& /\.xlsx?$/.test(fileURL)) {
      // if the URL doesn't start with http
      if (!/^http/.test(fileURL)) {
        fileURL = window.location.protocol + "//" + window.location.host + fileURL;
      }
      var ohtml = document.createElement('div');
      ohtml.style.padding = "10px";
      ohtml.style.display = "inline-block";
      ohtml.style.width = "200px";
      ohtml.style.width = "200px";
      ohtml.innerHTML = '&lt;style>'
                      + '.opendocument_button { background-color:#fdfdfd; border:1px solid #ababab; color:#444; display:inline-block; padding: 7px 10px; }'
                      + '.opendocument_button:hover { box-shadow: none }'
                      + '#opendocument_readonly,#opendocument_edit { float:none; font-size: 100%; line-height: 1.15; margin: 0; overflow: visible; box-sizing: border-box; padding: 0; height:auto }'
                      + '.opendocument_ul { list-style-type:none;margin-top:10px;margin-bottom:10px;padding-top:0;padding-bottom:0 }'
                      + '&lt;/style>'
                      + 'You are about to open:'
                      + '&lt;ul class="opendocument_ul">'
                      + '  &lt;li>Name: &lt;b>'+fileURL.split("/").slice(-1)+'&lt;/b>&lt;/li>'
                      + '  &lt;li>From: &lt;b>'+window.location.hostname+'&lt;/b>&lt;/li>'
                      + '&lt;/ul>'
                      + 'How would like to open this file?'
                      + '&lt;ul class="opendocument_ul">'
                      + '  &lt;li>&lt;label>&lt;input type="radio" name="opendocument_choices" id="opendocument_readonly" checked> Read Only&lt;/label>&lt;/li>'
                      + '  &lt;li>&lt;label>&lt;input type="radio" name="opendocument_choices" id="opendocument_edit"> Edit&lt;/label>&lt;/li>'
                      + '&lt;/ul>'
                      + '&lt;div style="text-align: center;margin-top: 20px;">&lt;button type="button" class="opendocument_button" style="background-color: #2d9f2d;color: #fff;" onclick="modalOpenDocument.close(document.getElementById(\'opendocument_edit\').checked)">Open&lt;/button> &lt;button type="button" class="opendocument_button" style="margin-left:10px" onclick="modalOpenDocument.close(-1)">Cancel&lt;/button>&lt;/div>';
      // show the modal
      modalOpenDocument=SP.UI.ModalDialog.showModalDialog({
        html:ohtml,
        dialogReturnValueCallback:function(ret) {
          if (ret!==-1) {
            if (ret === true) { // edit
              // reformat the fileURL
              var ext;
              if (/\.xlsx?$/.test(b)) ext = "ms-excel";
              if (/\.docx?$/.test(b)) ext = "ms-word"; // not currently supported
              fileURL = ext + ":ofe|u|" + fileURL;
            }
            window.location.href = fileURL; // open the file
          }
        }
      });
      a.preventDefault();
      a.stopImmediatePropagation()
      a.cancelBubble = true;
      a.returnValue = false;
      return false;
    }
    return bak_DispEx.apply(this, arguments);
  }
}, "sp.scriptloaded-core.js")
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2017/02/09/how-to-open-an-excel-document-from-sharepoint-files-into-chromefirefox-in-readonlyedit-mode/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Yes, you can be lazy and get more than 5000 SharePoint Items</title>
		<link>https://blog.kodono.info/wordpress/2016/12/06/yes-you-can-be-lazy-and-get-more-than-5000-sharepoint-items/</link>
					<comments>https://blog.kodono.info/wordpress/2016/12/06/yes-you-can-be-lazy-and-get-more-than-5000-sharepoint-items/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Tue, 06 Dec 2016 08:32:04 +0000</pubDate>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Niveau débutant]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=1733</guid>

					<description><![CDATA[To reply to this blog post I wanted to share the same thing but with SharepointPlus. To use the paging option and get all the content from a large Sharepoint list you can simply do the below code: $SP().list("My List").get({ fields:"ID,Title", rowlimit:5000, paging:true, progress:function progress(nbItemsLoaded) { // for each new page this function will be [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>To reply to <a href="http://sympmarc.com/2016/11/30/25696/">this blog post</a> I wanted to share the same thing but with <a href="http://aymkdn.github.io/SharepointPlus/">SharepointPlus</a>.</p>
<p>To use the paging option and get all the content from a large Sharepoint list you can simply do the below code:</p>
<pre class="brush:javascript">
$SP().list("My List").get({
  fields:"ID,Title",
  rowlimit:5000,
  paging:true,
  progress:function progress(nbItemsLoaded) {
    // for each new page this function will be called
    console.log("It's still loading... already "+nbItemsLoaded+" items have been loaded!");
  }
}, function(data) {
  console.log(data.length); // -> 23587
  for (var i=0, len=data.length; i&lt;len; i++) {
    console.log(data[i].getAttribute("ID"))
  }
})
</pre>
<p>If you only want to get the first 15,000 items, you can use the option <code>page:3</code>. See <a href="http://aymkdn.github.io/SharepointPlus/symbols/%24SP%28%29.list.html#.get">the documentation</a> to know more.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2016/12/06/yes-you-can-be-lazy-and-get-more-than-5000-sharepoint-items/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Execute an action before saving a form but after the form validation [Sharepoint]</title>
		<link>https://blog.kodono.info/wordpress/2016/11/18/execute-action-before-saving-a-form-and-after-form-validation-sharepoint/</link>
					<comments>https://blog.kodono.info/wordpress/2016/11/18/execute-action-before-saving-a-form-and-after-form-validation-sharepoint/#comments</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Fri, 18 Nov 2016 14:44:22 +0000</pubDate>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Niveau intermédiaire]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=1721</guid>

					<description><![CDATA[Let&#8217;s say you want to do an asynchronous request just before saving a Sharepoint form, but after Sharepoint verified all the fields in your form (for mandatory ones, or for format, &#8230;). Here is my solution to do it (using jQuery.Deferred): // this function will do our asynchronous check function beforeSaving() { var deferred=jQuery.Deferred(); setTimeout(function() [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Let&#8217;s say you want to do an asynchronous request just before saving a Sharepoint form, but after Sharepoint verified all the fields in your form (for mandatory ones, or for format, &#8230;). Here is my solution to do it (using jQuery.Deferred):</p>
<pre class="brush:javascript">
// this function will do our asynchronous check
function beforeSaving() {
  var deferred=jQuery.Deferred();
  setTimeout(function() {
    alert("Test Complete!")
    deferred.reject(); // if the test failed
    // or deferred.resolve() to valid the test
  }, 2000)
  return deferred;
}
// force PostBackRequired to true in the context, otherwise it won't work if you open it into a modal
WPQ2FormCtx.PostBackRequired=true;
// we override SPClientForms.ClientFormManager.SubmitClientForm
SPClientForms.ClientFormManager.SubmitClientForm=function(b){
  var a=SPClientForms.ClientFormManager.GetClientForm(b);
  var res = (a!=null&#038;&a.SubmitClientForm());
  // if the form is not valid, then res===true
  if (res === true) return true;
  else {
    // at this stage, all fields' value have been saved into a hidden input
    // e.g. document.querySelector('input[type="hidden"][id$="Field_x0020_Name"]')
    // all these saved values will be sent back to the server when "WebForm_DoPostBackWithOptions" is executed

    // if the form is valid we now want to do our asynchronous check
    beforeSaving().done(function() {
      // our test is valid too so we can send the form to the server
      WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions($get(WPQ2FormCtx.SubmitButtonID).name, "", true, "", "", false, true))
    }).fail(function() {
      // if it fails we just unblock the save button
      $get(WPQ2FormCtx.SubmitButtonID).disabled=false;
    })
  }
  // to make sure the form won't be submitted yet
  return true;
};
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2016/11/18/execute-action-before-saving-a-form-and-after-form-validation-sharepoint/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>Disable X-Frame-Options on Sharepoint</title>
		<link>https://blog.kodono.info/wordpress/2016/11/08/disable-x-frame-options-on-sharepoint/</link>
					<comments>https://blog.kodono.info/wordpress/2016/11/08/disable-x-frame-options-on-sharepoint/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Tue, 08 Nov 2016 17:34:18 +0000</pubDate>
				<category><![CDATA[Astuce]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Niveau intermédiaire]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=1716</guid>

					<description><![CDATA[I needed to communicate with an iframe on Sharepoint, however Sharepoint returned Load denied by X-Frame-Options &#8230; To override this limitation you have to create a Webpart page where you&#8217;ll add the code &#60;WebPartPages:AllowFraming runat="server" /> into the &#60;asp:Content> section (that might work somewhere else, but I did this way). You can also add it [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I needed to communicate with an iframe on Sharepoint, however Sharepoint returned <code>Load denied by X-Frame-Options</code> &#8230; To override this limitation you have to create a Webpart page where you&#8217;ll add the code <code>&lt;WebPartPages:AllowFraming runat="server" /></code> into the <code>&lt;asp:Content></code> section (that might work somewhere else, but I did this way).</p>
<p>You can also add it into your masterpage to allow it everywhere on your website. Add it into your <code>&lt;head></code> block:<br />
<a href="https://blog.kodono.info/wordpress/wp-content/uploads/2016/11/masterpage_allow_ifram.png" title="See full size image"><img loading="lazy" decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2016/11/masterpage_allow_ifram-1024x319.png" alt="" width="1024" height="319" class="aligncenter size-large wp-image-1836" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2016/11/masterpage_allow_ifram-1024x319.png 1024w, https://blog.kodono.info/wordpress/wp-content/uploads/2016/11/masterpage_allow_ifram-300x93.png 300w, https://blog.kodono.info/wordpress/wp-content/uploads/2016/11/masterpage_allow_ifram-768x239.png 768w, https://blog.kodono.info/wordpress/wp-content/uploads/2016/11/masterpage_allow_ifram.png 1672w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></p>
<p>Now you can use <code>postMessage()</code> to communicate with your iframe.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2016/11/08/disable-x-frame-options-on-sharepoint/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Hide a field into a form with JSLink based on field&#8217;s description [Sharepoint]</title>
		<link>https://blog.kodono.info/wordpress/2016/11/03/hide-a-field-into-a-form-with-jslink-based-on-fields-description-sharepoint/</link>
					<comments>https://blog.kodono.info/wordpress/2016/11/03/hide-a-field-into-a-form-with-jslink-based-on-fields-description-sharepoint/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Thu, 03 Nov 2016 15:02:07 +0000</pubDate>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Niveau débutant]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[sharepoint]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=1698</guid>

					<description><![CDATA[On Sharepoint 2013 I was trying to hide a field (the complete row) based on some elements into its description. To do so we will call our file using the JSLink (see my previous post about it). The JS file looks like that: (function() { // do some actions as soon as the fields are [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>On Sharepoint 2013 I was trying to hide a field (the complete row) based on some elements into its description.</p>
<p>To do so we will call our file using the JSLink (see <a href="https://blog.kodono.info/wordpress/2016/08/25/bypass-a-lookup-field-not-displayed-because-of-threshold-on-newform-and-editform-sharepoint-2013/">my previous post</a> about it).<br />
The JS file looks like that:</p>
<pre class="brush:javascript">
(function() {
  // do some actions as soon as the fields are shown
  var loadAfterForm = {
    Templates: {
      OnPostRender:function(ctx) {
        // hide the field/row when "[INTERNAL USE - DO NOT CHANGE]" is detected in the field's description
        if (ctx.ListSchema.Field[0].Description.indexOf('[INTERNAL USE - DO NOT CHANGE]') > -1) {
          // get the element that represents the field
          var elem = document.querySelector('[id^="'+ctx.ListSchema.Field[0].Name +'_'+ ctx.ListSchema.Field[0].Id+'"]');
          while (elem) {
            elem = elem.parentNode;
            if (elem) {
              if (elem.tagName==="BODY") break;
              if (elem.tagName === "TD" &#038;& elem.className.indexOf("ms-formbody") > -1) {
                // hide the whole row
                elem.parentNode.style.display="none";
                break;
              }
            }
          }
        }
      }
    }
  }
  SPClientTemplates.TemplateManager.RegisterTemplateOverrides(loadAfterForm);
})();
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2016/11/03/hide-a-field-into-a-form-with-jslink-based-on-fields-description-sharepoint/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Bypass a lookup field not displayed because of threshold on NewForm and EditForm [Sharepoint 2013]</title>
		<link>https://blog.kodono.info/wordpress/2016/08/25/bypass-a-lookup-field-not-displayed-because-of-threshold-on-newform-and-editform-sharepoint-2013/</link>
					<comments>https://blog.kodono.info/wordpress/2016/08/25/bypass-a-lookup-field-not-displayed-because-of-threshold-on-newform-and-editform-sharepoint-2013/#comments</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Thu, 25 Aug 2016 16:15:48 +0000</pubDate>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Niveau intermédiaire]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[Sharepoint 2013]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=1687</guid>

					<description><![CDATA[EDIT 22/Dec/2016: there is s a new version of this article at https://blog.kodono.info/wordpress/2016/12/22/2-bypass-a-lookup-field-not-displayed-because-of-threshold-on-newform-and-editform-sharepoint-2013/ Sharepoint is really annoying to limit the access to the list with more than 5,000 items&#8230; It causes many troubles, and one of them is when you use a lookup field into a form that is tied to a big list. Sharepoint [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>EDIT 22/Dec/2016</strong>: there is s a new version of this article at <a href="https://blog.kodono.info/wordpress/2016/12/22/2-bypass-a-lookup-field-not-displayed-because-of-threshold-on-newform-and-editform-sharepoint-2013/">https://blog.kodono.info/wordpress/2016/12/22/2-bypass-a-lookup-field-not-displayed-because-of-threshold-on-newform-and-editform-sharepoint-2013/</a></p>
<p>Sharepoint is really annoying to limit the access to the list with more than 5,000 items&#8230; It causes many troubles, and one of them is when you use a lookup field into a form that is tied to a big list. Sharepoint will not display the field/dropdown but will show the message:</p>
<blockquote><p>This is a lookup column that displays data from another list that currently exceeds the List View Threshold defined by the administrator</p></blockquote>
<p>There is a solution to bypass this problem and show our lookup dropdowns.</p>
<p>You need:</p>
<ul>
<li><a href="http://jquery.com/">jQuery</a></li>
<li><a href="http://aymkdn.github.io/SharepointPlus/">Sharepoint</a></li>
<li>And I use <a href="https://harvesthq.github.io/chosen/">Chosen</a> to have a better dropdown</li>
</ul>
<p>I&#8217;ll show how I did it for the <strong>EditForm</strong>.</p>
<p>First, <strong>copy/paste the below JavaScript code</strong> into a file that you&#8217;ll store somewhere on your Sharepoint:</p>
<pre class="brush:javascript">
// load jQuery, SharepointPlus and Chosen
var toLoad = '&lt;script src="/Toolbox/Documents/js/jQuery/jquery-1.12.3.min.js">&lt;/script>'
           + '&lt;script src="/Toolbox/Documents/js/SharepointPlus/3.13/sharepointplus-3.13.min.js">&lt;/script>'
           + '&lt;link href="/Toolbox/Documents/js/Chosen/1.5.0/chosen.min.css" rel="stylesheet" type="text/css">'
           + '&lt;script src="/Toolbox/Documents/js/Chosen/1.5.0/chosen.jquery.min.js">&lt;/script>'
document.write(toLoad);

(function() {
  var aDeferred=[];
  var modal;
  // list the fields we want to fix
  // /!\ Add here the Field ID of the fields that need to be fixed
  var lookupFieldsToFix = ["Voucher_x0020_Code", "User_x0020_Name"];
  // /!\ Specify the name of the related list, as well as the Column to retrieve
  var configurationsLookup = [{list:"Vouchers", field:"Title"}, {list:"Users", field:"Name"}];

  // this function is triggered once the form is loaded
  function allLoaded(ctx) {
    // delete all existing localStorage
    localStorage.removeItem('RequestsLookup')
    // check if our call to lists are done
    $.when.apply(this, aDeferred).done(function() {
      var save={}, count=0, i;
      for (i=arguments.length; i--;) {
        if (arguments[i]) {
          save[arguments[i].field] = arguments[i].choices; // save it as {fieldName:choices}
          count++;
        }
      }
      if (count > 0) {
        // we use localStorage
        localStorage.setItem('RequestsLookup', JSON.stringify(save));
        // now reload the page
        $SP().closeModalDialog();
        $('#aspnetForm').hide().after('&lt;h1>Reloading...&lt;/h1>');
        window.location.reload();
      } else {
        // we use Chosen
        for (i=lookupFieldsToFix.length; i--;) {
          var e=WPQ2FormCtx.ListSchema[lookupFieldsToFix[i]];
          $(document.getElementById(e.Name+"_"+e.Id+"_$"+e.FieldType+"Field")).chosen({search_contains:true});
        }
        // and on Exam Name
        $SP().formfields("Exam Name").elem().chosen({search_contains:true});
      }
    })
  }
  
  /**
   * Fix the broken lookup fields
   * @param  {String} field Name of the field to fix
   * @return {Deferred}
   */  
  function fixLookup(field) {
    var deferred = jQuery.Deferred();
    var saved, choices=[], config;

    // we check if there is a Throttled
    if (WPQ2FormCtx.ListSchema[field].Throttled) {
      WPQ2FormCtx.ListSchema[field].Throttled=false;
      // check if we have a localStorage, if yes it means we are after the reload
      saved = localStorage.getItem("RequestsLookup");
      if (saved !== null) {
        saved = JSON.parse(saved);
        // we use the stored data to create our dropdown
        WPQ2FormCtx.ListSchema[field].ChoiceCount=saved[field].length;
        WPQ2FormCtx.ListSchema[field].Choices=saved[field];
        deferred.resolve();
      } else {
        WPQ2FormCtx.ListSchema[field].ChoiceCount=0;
        WPQ2FormCtx.ListSchema[field].Choices=[];
        // then we show a Waiting message
        if (!modal) {
          modal=true;
          $SP().waitModalDialog("Loading some data...");
        }
        // and we get data from the list
        config = configurationsLookup[SPArrayIndexOf(lookupFieldsToFix, field)];
        if (config.list) {
          $SP().list(config.list).get({fields:config.field, paging:true}, function(data) {
            var res=[];
            for (var i=data.length; i--;) {
              res.push({LookupId:data[i].getAttribute("ID"), LookupValue:data[i].getAttribute(config.field)});
            }
            deferred.resolve({field:field, choices:res});
          });
        } else deferred.resolve([]);
      }

    } else deferred.resolve();
    return deferred;
  }

  // do some actions as soon as the fields are shown
  var changeForm = {
    Templates: {
      OnPreRender:function(ctx) {
        // we want to show Voucher Code and User Name even if there are more than 5000 items in those lists
        if (SPArrayIndexOf(lookupFieldsToFix, ctx.ListSchema.Field[0].Name) > -1) {
          aDeferred.push(fixLookup(ctx.ListSchema.Field[0].Name));
        }
      },
      OnPostRender:function(ctx) {
        // only trigger when everything is loaded
        if (ctx.ListSchema.Field[0].Name === "Attachments") {
          allLoaded(ctx)
        }
      }
    }
  }
  // don't do it when editing the page
  if (GetUrlKeyValue("PageView") !== "Shared") SPClientTemplates.TemplateManager.RegisterTemplateOverrides(changeForm);
})();
</pre>
<p>Please refer to the <strong>/!\</strong> symbol to configure two variables: only <code>lookupFieldsToFix</code> and <code>configurationsLookup</code> need to be set by you.<br />
Note that the above code is compatible for IE8+, and all modern browsers.</p>
<p>Now go to the <strong>EditForm.aspx</strong> of your list. Then <strong>edit the page</strong>:<br />
<img loading="lazy" decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2016/08/capture1.png" alt="showing how to edit the EditForm thru Settings" width="1091" height="313" class="aligncenter size-full wp-image-1691" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2016/08/capture1.png 1091w, https://blog.kodono.info/wordpress/wp-content/uploads/2016/08/capture1-300x86.png 300w, https://blog.kodono.info/wordpress/wp-content/uploads/2016/08/capture1-768x220.png 768w, https://blog.kodono.info/wordpress/wp-content/uploads/2016/08/capture1-1024x294.png 1024w" sizes="auto, (max-width: 1091px) 100vw, 1091px" /></p>
<p>Next, <strong>edit the webpart settings</strong>:<br />
<img loading="lazy" decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2016/08/capture2.png" alt="show how to edit webpart settings" width="840" height="432" class="aligncenter size-full wp-image-1690" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2016/08/capture2.png 840w, https://blog.kodono.info/wordpress/wp-content/uploads/2016/08/capture2-300x154.png 300w, https://blog.kodono.info/wordpress/wp-content/uploads/2016/08/capture2-768x395.png 768w" sizes="auto, (max-width: 840px) 100vw, 840px" /></p>
<p>Go to the <strong>Miscellaneous section</strong> and enter the path to your JavaScript file (created before) in the <strong>JS Link</strong> field – you can use <code>~site</code> in the path:<br />
<img loading="lazy" decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2016/08/capture3.png" alt="show where to input the path to the JS file" width="346" height="385" class="aligncenter size-full wp-image-1692" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2016/08/capture3.png 346w, https://blog.kodono.info/wordpress/wp-content/uploads/2016/08/capture3-270x300.png 270w" sizes="auto, (max-width: 346px) 100vw, 346px" /></p>
<p>Finally click ON, and then on <strong>Stop Editing</strong> in the ribbon.</p>
<p>You can now try to edit an item and the lookup fields should be fixed. Example:<br />
<img loading="lazy" decoding="async" src="https://blog.kodono.info/wordpress/wp-content/uploads/2016/08/capture4.png" alt="" width="869" height="217" class="aligncenter size-full wp-image-1694" srcset="https://blog.kodono.info/wordpress/wp-content/uploads/2016/08/capture4.png 869w, https://blog.kodono.info/wordpress/wp-content/uploads/2016/08/capture4-300x75.png 300w, https://blog.kodono.info/wordpress/wp-content/uploads/2016/08/capture4-768x192.png 768w" sizes="auto, (max-width: 869px) 100vw, 869px" /></p>
<p><strong>NOTE</strong></p>
<p>The <code>document.write()</code> is not really a good practice because it will delay the page load. It would be better to load asyn the JS using <a href="https://gist.github.com/Aymkdn/98acfbb46fbe7c1f00cdd3c753520ea8">this tiny function</a>. In that case you need to make sure to have only Vanilla JS in your <code>changeForm</code>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2016/08/25/bypass-a-lookup-field-not-displayed-because-of-threshold-on-newform-and-editform-sharepoint-2013/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>Load a script once a DispForm is fully shown in Sharepoint 2013</title>
		<link>https://blog.kodono.info/wordpress/2016/05/30/load-a-script-once-a-dispform-is-fully-shown-in-sharepoint-2013/</link>
					<comments>https://blog.kodono.info/wordpress/2016/05/30/load-a-script-once-a-dispform-is-fully-shown-in-sharepoint-2013/#respond</comments>
		
		<dc:creator><![CDATA[Aymeric]]></dc:creator>
		<pubDate>Mon, 30 May 2016 10:48:54 +0000</pubDate>
				<category><![CDATA[Niveau intermédiaire]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[sharepoint]]></category>
		<category><![CDATA[Sharepoint 2013]]></category>
		<guid isPermaLink="false">https://blog.kodono.info/wordpress/?p=1654</guid>

					<description><![CDATA[Sharepoint 2013 introduced the JSLink. This is very useful to play with forms and views. My attempt here is to remove some rows from the DispForm. To do so I needed to trigger an action as soon as the fields rendering has been done. After different tries, I finally came up with the PostRender option. [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Sharepoint 2013 introduced the <a href="http://jsuhail.blogspot.fr/2014/09/client-side-rendering-using-jslink-post_30.html">JSLink</a>. This is very useful to play with forms and views.</p>
<p>My attempt here is to remove some rows from the DispForm. To do so I needed to trigger an action as soon as the fields rendering has been done. After different tries, I finally came up with the <code>PostRender</code> option.</p>
<pre class="brush:javascript">
// https://gist.github.com/Aymkdn/98acfbb46fbe7c1f00cdd3c753520ea8
function loadExt(e,t){var s=this;s.files=e,s.js=[],s.head=document.getElementsByTagName("head")[0],s.after=t||function(){},s.loadStyle=function(e){var t=document.createElement("link");t.rel="stylesheet",t.type="text/css",t.href=e,s.head.appendChild(t)},s.loadScript=function(e){var t=document.createElement("script");t.type="text/javascript",t.src=s.js[e];var a=function(){++e&lt;s.js.length?s.loadScript(e):s.after()};t.onload=function(){a()},s.head.appendChild(t)};for(var a=0;a&lt;s.files.length;a++)/\.js$|\.js\?/.test(s.files[a])&#038;&s.js.push(s.files[a]),/\.css$|\.css\?/.test(s.files[a])&#038;&s.loadStyle(s.files[a]);s.js.length>0?s.loadScript(0):s.after()}

// verify when all scripts have been loaded
var loadExtLoaded = false;
function checkExt(ctx) {
  if (loadExtLoaded) {
    // here you can call a function that is in one of the called script
  } else {
    setTimeout(function() { checkExt(ctx) }, 50);
  }
}
loadExt([
  'file_you_want_to_load.js',
  'style_you_want_to_load.css',
  'no_cache_file.js?timestamp='+(Date.now())
], function() {
  loadExtLoaded=true;
});

(function() {
  function onLoad(ctx) {
    checkExt(ctx);
  }

  // do some actions as soon as the fields are shown
  var loadAfterForm = {
    Templates: {
      OnPostRender:function(ctx) {
         // only trigger when everything is loaded
        // --> ctx.ListData.Items[0] all the fields
        if (ctx.ListSchema.Field[0].Name === "Attachments") {
          onLoad(ctx)
        }
      }
    }
  }
  SPClientTemplates.TemplateManager.RegisterTemplateOverrides(loadAfterForm);
})();
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.kodono.info/wordpress/2016/05/30/load-a-script-once-a-dispform-is-fully-shown-in-sharepoint-2013/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
