Create WebConfigModification PowerShell

The WebConfigModification allow you to modif the web.config of the web application. It will be saved in the settings database.. When Apply the method ApplyWebConfigModifications of the the class SPWebService (Microsoft.SharePoint.Administration).

To create WebConfigModification

—————————————————————————

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
#change the ur of your web application 
$webApp=Get-SPWebApplication -Identity "http://win-o2tqsp5voae:21288/"

 $bindig = New-Object "Microsoft.SharePoint.Administration.SPWebConfigModification"
 #The path to identifie the new node 
$bindig.Path = "configuration/system.serviceModel/bindings/basicHttpBinding"
#It is very important to deleting the node. By name SharePoint can find the
#node. must be unique to delete it. the format is: tagName[@name='Name'] 
$bindig.Name = "binding[@name='MyBinding']"
 $bindig.Sequence = 0
#the type of ConfigModification : 0= EnsureChildNode
 $bindig.Type = 0
#The owner of the modification
 $bindig.Owner = "MyWebConfigOwner"
 $bindig.Value = ""
 $webApp.WebConfigModifications.Add($bindig)

$webApp.Update()
 $webApp.Parent.ApplyWebConfigModifications()

To delete WebConfigModifcation


Add-PSSnapin "Microsoft.SharePoint.PowerShell"

# Web appication URL
$webapp=Get-SPWebApplication -Identity "http://win-o2tqsp5voae:21288/"

#delete all WebConfigModification fo the Owner
$Modification = $webapp.WebConfigModifications | ? { $_.Owner -eq "MyWebConfigOwner"}
 
 if($Modification -ne $null){
 
 write-Host "Deleting existing entries"
 
 
 foreach($mod in $Modification){
  $webapp.WebConfigModifications.Remove($mod)
 } 
$webapp.Update() 
$webapp.Parent.ApplyWebConfigModifications() 
Write-Host "Complete"
}
else
{Write-Host "no Item"}
Advertisements
Posted in Administration, Power Shell | Tagged | Leave a comment

Bing Maps- geolocation column

  1. Overview bing Map

This feature was integrated  in SharePoint 2013 (automatically in SharePoint Online).  based on Bing map service  https://www.bingmapsportal.com/ISDK/AjaxV7#CreateMap1.

Mostly, there is a field type « Geolocation »  (Hidden)  that integrate any call of the Map service, and show the data in the list.  We will can also create a view from type MAP.

 

Add item:

Display Item

Create Map view

2. Installation

In SharePoint Online this column already exist.

In SharePoint On premise we need :
Bing Maps Key 
-Install SQLSysClrTypes.msi in all front-end servers.

To edit the BingMapsKey, open "SharePoint Management Shell" and execute: 
Set-SPBingMapsKey -BingKey $key
To add column to the list:
web=Get-SPWeb($urlSite)
$list=$web.Lists[$listTitle] 
$list.Fields.AddFieldAsXml("<Field Type='Geolocation' DisplayName='Location' />",
$true,[Microsoft.SharePoint.SPAddFieldOptions]::Default)

 

 

 

Posted in SharePoint 2013, sharepoint online | Leave a comment

send Mails sp.js

Utilities.SendMail = function (from,to, body, subject,success,error)
{
 //Get the relative url of the site
 var siteurl = _spPageContextInfo.webServerRelativeUrl;
 var urlTemplate = siteurl + "/_api/SP.Utilities.Utility.SendEmail";
 $.ajax({
 contentType: 'application/json',
 url: urlTemplate,
 type: "POST",
 data: JSON.stringify({
 'properties': {
 '__metadata': {
 'type': 'SP.Utilities.EmailProperties'
 },
 'From': from,
 'To': {
 'results': [to]
 },
 'Body':body ,
 'Subject': subject
 }
 }),
 headers: {
 "Accept": "application/json;odata=verbose",
 "content-type": "application/json;odata=verbose",
 "X-RequestDigest": jQuery("#__REQUESTDIGEST").val()
 },
 success: success,
 error: error
 });
 
}
Posted in sharepoint online | Leave a comment

Permissions list

var list = web.get_lists().getByTitle(titleList);
 


list.breakRoleInheritance(false, true);

var roleDefBindingAdmin = SP.RoleDefinitionBindingCollection.newObject(context);
 roleDefBindingAdmin.add(web.get_roleDefinitions().getByType(SP.RoleType.administrator));


 var roleDefBindingColl = SP.RoleDefinitionBindingCollection.newObject(context);
 roleDefBindingColl.add(web.get_roleDefinitions().getByType(SP.RoleType.contributor));

var roleDefBindingRead = SP.RoleDefinitionBindingCollection.newObject(context);
 roleDefBindingRead.add(web.get_roleDefinitions().getByType(SP.RoleType.reader));

list.get_roleAssignments().add(groupCollection.getByName(Gr_Owner), roleDefBindingAdmin);

 list.get_roleAssignments().add(groupCollection.getByName(Gr_PPM_Corportate), roleDefBindingColl);

 list.get_roleAssignments().add(groupCollection.getByName(Gr_PPM_Network), roleDefBindingRead);

context.executeQueryAsync(function () {
 SuccessMessage('permissions of list <strong>' + titleList + '</strong> was updated');

 }, ErrorCall);
Posted in JSOM, sharepoint online | Leave a comment

Imports CSV

Import intelligently, CSV files in a SharePoint list. The file can be exported from another list by Microsoft Excel and used it directly in the apps.

1. Set the parameters of the imports (parameters will be pre-configured according to the language site)

-Ignore line if contain more or less columns

-Ignore line that contain error format

-Choose option to search users (mails, login, mails)

-Chose the date format

-Choose the Boolean value (yes/no, true/false, 1/0)

-Choose the encoding

2. Mapping the columns

mapping between the columns of the list and the columns of the file. By default App search intelligently the correspondence.

3. Overview

The App show the result of import before the upload. And show also the alerts and messages: Number not valid, Url not valid, user does not exist, line contain more columns.

4. After importing items, you

 

https://store.office.com/en-001/app.aspx?assetid=WA104379900&sourcecorrid=53a3dc6b-0550-498f-b428-ecc1c61f158c&searchapppos=3&ui=en-US&rs=en-001&ad=US&appredirect=false

Posted in Published projets | Leave a comment

SharePoint Rules Permissions

Management rule permission is a feature for SharePoint 2010/2013 allows users to manage permissions in a dynamic way.
The feature allows the List administrator user to define rules permissions when list item is added or updated.
rules can be related to the properties of the list or properties of User profile service.

example:
for each new task added / changed, assign this permissions to the item:
Assigned To: Contribute
Responsable of Assigned To : Read
Group Manager: Full Control

the application is bilingual: English and French.

 

http://permissionmanagement.codeplex.com/

Posted in Published projets | Leave a comment

Workflow validation

In SharePoint there is many workflow that allow you to validate list items. But, sometimes you must change your validation system to adapt to this workflow. For example, for the three steps validation, you have exactly a three steps and you have three actors. The solution ‘Workflow validation’ allow you to create your custom business process of validation.

From an administration interface, you add your steps and your actors dynamically switch the item.
These is a set of steps, when you define for each step the validator and the type of step. There is two type of step:validation task, and mail notification.

  1.        To specify the validator, there is three method to calculate him:
    static user: User or group
  2.        From the list column
  3.        From the user profile properties.

The workflow generate all the texts dynamically from the list properties: Object mail, body mail, title of the task and description of the task.

The workflow can create other additional tasks undefined in the business process. In fact, in some tasks, the validator can extends her task to be validated by another user or group. Therefore step in another actor to the process. The actors can validate without permissions on the item.

The solution has designed to validate any types of items (List, Library, Calendar, Event…). Then the workflow use a specific columns, added automatically to the list when you associate the workflow. This columns are:
Historic: to persist the comments of the validator
Status: to persist the state of the item (In progress, Validated, Refused).
The workflow use also a custom validation task with a custom interface.

In the same list you can change the validation process. But this changing will be applied to the new instance of the workflow. The old instance continue to using the old process.

Example of validation

This is a validation process used in many portals: The leave request. Using this solution you create your custom validation process without need to Visual studio or SharePoint designer. And with the same efficiency.

You create custom list ‘Leave request’ with this columns.
-Start date: date
-End date: date
-Comment: Text
-Teams: Users
-Team leader: User
The leave request pass by this process.

  1.        Validation team leader: Defined by the creator in the column ‘team leader’. If necessary the team leader can step in another user or team leader.
  2.        Validation Responsible: responsible defined in user profile properties of the creator.
  3.        Validation Group HR: static group
  4.        Send mail to the all team: The creator define all the members of team when he create the leave.
  5.        Validation per group ‘Administration Assistant’: to update the leave balance of the creator. In this step the group cannot refuse the item. He post a comment and validate.
  6.        Notify the creator: Send email the creator to notify her validation.

How it works

  1.        Install the solution
  2.        Activate the site feature ‘Validation workflow’
  3.        Activate the web feature ‘Validation workflow’
  4.        Associate the workflow ‘Validation workflow’ to the list.
  5.        Create your custom business process and associate.

http://workflowvalidation.codeplex.com/

Posted in Published projets | Leave a comment