Showing posts with label SharePoint. Show all posts
Showing posts with label SharePoint. Show all posts

Thursday, 1 June 2017

Developer Dashbord SharePoint PowerShell

Developer Dashbord
$cs = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$dash= $cs.DeveloperDashboardSettings
$dash.DisplayLevel
$dash.DisplayLevel="Off" // Ondemand to activate
$dash.Update()


Wednesday, 22 March 2017

PropretyBag with JavaScript in SharePoint 2013




Hello,
as we know, Property bag are very important in SharePoint development, and to get it with JavaScript is very simple :



//wait until client object model dependencies are loaded before executing our code
ExecuteOrDelayUntilScriptLoaded(getWebProperties, "sp.js");
var webProperties;
function getWebProperties() {
    var clientContext = new SP.ClientContext.get_current();
    webProperties = clientContext.get_web().get_allProperties();
    clientContext.load(webProperties);
    clientContext.executeQueryAsync(Function.createDelegate(this, this.getWebPropertiesSucceeded), Function.createDelegate(this, this.onQueryFailed));
}
function getWebPropertiesSucceeded() {
          //debugger; //use this to force a break here
    //returns an object with all properties. 
          //Use the quick watch to expand this out to see all of them.
    var allProps = webProperties.get_fieldValues();
    var customProp = "";
         //make sure the property is there before using it.
    if(webProperties.get_fieldValues().CustomSite_Version != undefined)
    {
        var customProp = webProperties.get_fieldValues().CustomSite_Version;
    }
    alert(customProp);
}
function onQueryFailed(args, sender)
{
     //handle errors here
}



-----------
var customProp = webProperties.get_fieldValues().CustomSite_Version;

Friday, 24 February 2017

My first experience with SharePoint 2016 on premise

Hello,

Today i will share with you my Experience with SharePoint 2016 on premise.
I installed this farm on my Personnel machine. Just for testing with 6 RAM memory and 80 GB Hard disk, and also 2 processors. Ha-ha

The Top Bar:

As we see a new sexy black top bar. Same as Office 365.

New option MINROLE:

 Convert Server role in this farm, is a new option that’s allows us to change the role of each server simply.


Information policy

A new section in the security scope that helps us to configure IRM ;)


Friday, 17 February 2017

SharePoint XSN provisionning with WSP

it's not very simple to package a form xsn in the wsp solution, specialy if you want to do a provisionning.


You probably tried to use something like:
1 <elements xmlns="http://schemas.microsoft.com/sharepoint/">
2    <module name="DefaultForms" rootwebonly="FALSE" url="Lists/Forms">
3      <file path="DefaultForms\TestForm.xsn" type="GhostableInLibrary" url="TestForm.xsn"/>
4    </module>
5 </elements>

But if you just put the XSN files in a module and deploy it to a Form-library like this, or just upload the xsn file to the library, the Info Path form will not be able to render (error: form is not browser enabled).
What you have to do to fix this is adding some extra properties:
 1 <elements xmlns="http://schemas.microsoft.com/sharepoint/">
 2   <module 
 3        name="DefaultFormulieren" 
 4        rootwebonly="FALSE" 
 5        url="Lists/Forms">
 6      <file path="DefaultForms\myform.xsn" 
 7            type="GhostableInLibrary" url="TestForm.xsn">
 8        <property name="ContentTypeId"
 9                  value="XXXXXXXXXXXXXXXXXXXXXXXXXXX"/>
10        <property name="ContentType" value="Form"/>
11        <property name="vti_contenttag" type="string" 
12                  value="{xxxxxxxxxxxxxxxxxxxxxxxxx},2,1"/>
13        <property name="ipfs_streamhash" type="string"
14                  value="u+Z+9oSpboLO+KfE7V3NmgN0DfxlgCQB0/R8/S3pVBM="/>   

15      </file>
16   </module>
17 </elements>

  • ContentTypeId and ContentType are self explaining, but how to find the vti_contenttag and ipfs_streamhash?

  1.  open the form in InfoPath-designer and publish it to a SharePoint site.
  2.  create a WSP from the existing site.


If it’s a publishing site you cannot in a normal way access the ‘save site as template’ page. So you should browse to / _layouts/savetmpl.aspx. There's no shame in doing this (or in forgetting), just remeber that it's hidden for a reason!


Make sure ‘Include content’ is selected.
Download the WSP and rename to .cab
Now you can extract this file with (for example) winrar.
Browse to the just extracted files. 

Open the Modules folder
Under 'files' you’ll find the XSN file (under a subfolder with the name of the library), I always use this file to be absolutely sure it’s exactly the same as when a user publishes the original XSN with infopath.

Go back to the root folder of your extracted WSP and open the 'propertybag' folder.
In this folder open the elements.xml. 

Find the File tag for your XSN file. (just search for .xsn).

Here you’ll find the vti_contenttag and ipfs_streamhash values. You can just add these to your module, since SharePoint itself figures out if values are fields or need to be set to the propertybag.

Featured Post

Developer Dashbord SharePoint PowerShell

Developer Dashbord $cs = [Microsoft.SharePoint.Administration.SPWebService]::ContentService $dash= $cs.DeveloperDashboardSettings $dash....