how to display radio buttons and choice fields horizontally in SharePoint 2013

how to display radio buttons and choice fields horizontally in SharePoint 2013

In this article we can able to see how to display radio buttons and choice fields horizontally.
By default it will display vertically , for better look and feel at the time of customizing we want to display init horizontally.

//dispaly radiobuttons horizontally
var getRadio = $("#showhor .ms-RadioText:eq(0)")
$("#showhor .ms-RadioText:gt(0)").appendTo($(getRadio));

HTML Form 

Select all that apply:
<span id="showhor" data-displayName="Status"></span>

Create CallOuts in SharePoint

Create CallOuts in SharePoint
In this article we can able to see how to use callouts in SharePoint

In my requirement  having a status column having multiple drop down values , i will need to explain about the values available in the drop down.

For that i used Callouts which is newly introduced in SharePoint2013.


function mycallOuts(){
SP.SOD.executeFunc("callout.js", "Callout", function () {
SP.SOD.executeFunc('sp.js', 'SP.ClientContext'); 
         var _getstatusid = document.getElementById("calStatus");
         var listCallout10 = CalloutManager.createNew({ 
         launchPoint: _getstatusid,
         beakOrientation: "leftRight", 
         ID: "CallOutID", 
         content: '<b>Red</b> <br>Rejected<br></br> <b>Green</b> <br>No Action Requried<br><br>'

HTML Form 

<td>Status of Current Task <span id='calStatus'><span>
 <td><span class="myownclass" data-displayName="Status"></span></td>

Cascading Dropdown list in SharePoint using InfoPath

In this article I explain how to create cascading dropdown based on state and city.
I created State, City and Address list with lookup.

Open Address list, Click on “Customize Form” under List tab. It will open InfoPath designer, now we can customize List Form.
Right click on City dropdown list control -> select Drop-Down List box Properties.
In Data Source -> click “Add” button.
 In Data Connection wizard, click “Next” button
Select “SharePoint library or list” -> Click “Next” button.
Enter “SharePoint site details” -> Click “Next” button.
Select a list of library, choose “City” -> Click “Next” button.     
In select fields: select State, City Name and ID -> Click “Next” button.

Next screen, click “next” button.
Leave the default name (City1) and click “Finish” button.

We can see now Data Source of Drop-down list box is City1
Click on tree button to select XPath, in Entries section.
Click “Filter Data” button.
 Click “Add” button in Filter Data

Choose a field or group... in the first drop-down list.

Choose City1 Data source and select State -> click “Ok” button.
Now select a field or group… in the last drop-down list
Select Main as Data Source then choose State in data Fields -> click “OK” button

Click “OK” to close specify Filter Conditions dialog
Click “OK” to close Filter Data dialog
Click “OK” to close Select a Field or Group
In Drop Down List box properties, choose d:ID in Value: section -> click “OK” to close this
Now Save and Publish the InfoPath Form view.  Go to Address list and Click new item.

Here we can see only state related cities in the dropdown list. 

How to Export and Import SharePoint Designer Workflows.

Open the SharePoint site in SP Designer, Click on workflows which is available in the left hand side.
Click on the workflow that you want to export as per the below screen shot.
Save the workflow as per the below.
 Workflow is saved in your system in VMI format.
How to Import SP Workflow
Now if you want to import the same workflow in any other site.
Follow the steps as per the below.
1)Add the .ZIP extension for the imported workflow and click on YES as per the below.
2)Open the Zip folder and delete the workflow.xoml.wfconfig.xml as highlighted in the below.
3)Right click on the workflow and remove the .ZIP
4)Again we can able to see the workflow in .VMI Extension.
5)Open the Site in SPDesigner that you want to Import the workflow into that particular site.
6)Click on “Import from Viso” as per the below screen shot.
7)Select the workflow path and click on Next.
8)Select the list that you want to associate the workflow and click on Finish.
9)Save the Workflow and update the changes in your workflow then save and publish.

Errors were found when compiling the workflow the workflow files were saved but cannot be run

We are getting the error “Errors were found when compiling the workflow the workflow files were saved but cannot be run “when we are trying to publish the workflow.
 In my scenario we restored the site from Dev to QA environment, once restore completed we are can able to see the work flows in SharePoint designer. I created a new item in the list but workflow did not triggered. We opened the designer and try to publish we are getting the below error. 

 In designer we identified that there is no associated list for this workflow, we have to give the current site List ID in the .WFconfig.xml file. To give this List ID we have to follow the below steps.
 Open the site in SP Designer
Click on “All Files”
Click on Workflows
In All Files expand the Workflows click on +
Again expand the particular workflow, there you can able to see the couple of files, open the .WFconfig.xml file in advanced mode there we can able to see the <Association ListID =”{previous list id}” , place the current site list id and save it.

Now you can able to see the workflow is Associated with list. We can able to Save and publish the Workflow without any issues.

Sending Approval Request Approval Failed in SharePoint 2013

For one of the site we given site owner email address in “Access request settings” , if anyone trying to access  the site who don’t have permissions they  will request for access to that site email will come to site owner.
 When site owner is trying to approve the request he was getting the error “Sending Approval Request Approval Failed” as per the below screen shot.

Navigate to “permsetup.aspx” page in the same site, URL looks like

Select the radio button option “Use an existing group”
In owners Group select the current owners Group name available in the current site and click on Ok.
Now you can able to approve the requests.

Another site or list is still using this content type. If you would still like to delete it, please remove the content type from all sites and lists and then try again.

When we are trying to delete the content type we are getting the below error.
Another site or list is still using this content type. If you would still like to delete it, please remove the content type from all sites and lists and then try again.

In my case I already deleted the list, but still I am facing the same error message. The same list is available in the recycle bin, follow the same steps as per the below.

Delete from site recycle bin.
Delete from Site Collection > Site Settings > Site Collection Administration > Recycle Bin.
Delete from End User Recycle Bin Items.
Path: _layouts/15/AdminRecycleBin.aspx
Delete from "Deleted From End User Recycle Bin."
Path: layouts/15/AdminRecycleBin.aspx?View=2
Now you can able to delete the content type successfully.

New-SPConfigurationDatabase : The user does not exist or is not unique

When we are trying to install SharePoint 2016 using PowerShell we got the below error.
“New-SPConfigurationDatabase : The user does not exist or is not unique ” as per the below screen we face the issue.
Resolution: Make sure once you run this command in the PowerShell credential popup window will come.

New-SPConfigurationDatabase –DatabaseName SharePoint_Config –DatabaseServer DNSP2016 –AdministrationContentDatabaseName SharePoint_Content –Passphrase (ConvertTo-SecureString DotNetSharePoint2016–AsPlaintext –Force) –FarmCredentials (Get-Credential) -localserverrole SingleServerFarm

We have to enter MachineName\UserName  as per the above screen shot.

Monitoring disk space utilization using powershell

Monitoring disk space utilization is an important task in SharePoint to avoid the critical issues , we can implemented this using PowerShell to monitor the disk utilization , in this we did not kept any threshold conditions , we are generating only report in CSV format with list of all servers available  in our  environment.
We created a config file to add all servers that you want to know the disk space utilization.
Added the server names as per the below screen shot in the text file.

Please note: we are generating this only in CSV format, it is a plane text we cannot add any colors in our output file.

Add-PSSnapin microsoft.sharepoint.powershell
$resultsarray = @()
$computers = (Get-Content "d:\Allservers.txt")
$date = Get-Date -Format “dd-MM-yyyy”
foreach($computer in $computers)
Write-Host $computer
 $drives = Get-WmiObject -ComputerName $computer Win32_LogicalDisk | Where-Object {$_.DriveType -eq 3}
 foreach($drive in $drives)
  $contactObject = new-object PSObject
   $id = $drive.DeviceID
 $totalsize = [math]::round($drive.Size /1GB, 2)
 $freespace = [math]::round($drive.FreeSpace  / 1GB, 2)
 $usedspace= $totalsize-$freespace
 $freeprecent = [math]::round($freespace / $totalsize, 2) * 100
 $diskObject | add-member -membertype NoteProperty -name "Date" -Value $date
 $diskObject | add-member -membertype NoteProperty -name "Server Name" -Value $computer
 $diskObject | add-member -membertype NoteProperty -name "Drive" -Value $id
  $diskObject | add-member -membertype NoteProperty -name "Total GB" -Value  $totalsize     
   $diskObject | add-member -membertype NoteProperty -name "Used GB" -Value $usedspace   
 $diskObject | add-member -membertype NoteProperty -name "Free GB" -Value $freespace  
    $diskObject | add-member -membertype NoteProperty -name "% Free" -Value $freeprecent  
$resultsarray += $diskObject
$resultsarray| Export-csv -path "D:\diskreport_$date.csv" –notypeinformation

Delete SharePoint list items based on particular view using PowerShell

Send email to members of SharePoint Group using PowerShell

In this article we can see how to send email only from a particular group of people using power shell, it is very easy to user to remove/add new users whenever they want. In the below code we created a SharePoint Group with name “DotNetSharePoint”

add-pssnapin microsoft.sharepoint.powershell
$web = get-spweb -identity  ""
$groupss = $web.Groups.GetByName("DotNetSharePoint")
$emailgrouptoo =@()
foreach($user in $groupss.Users)
$sendemailto  =  $user.Email
$totalemail =  $sendemailto
#You can also get this below information from Custom List also , in the article we are mainly showing how to send email to Owners Group Using PowerShell.
$smtpserver = "yourSMTP severname"
$emailfrm  =  "emailidfrom whom you have to send this email"
$Subject =  "We are sending email to Users"
$EmailBody  = "You type some information which you want to show in side the email body"
 send-mailmessage -smtpserver $smtpserver -from $emailfrm -to $emailgrouptoo  -subject $Subject -body $EmailBody

how to get the current item id for newly created item in SharePoint

In this article we can able to see how to get the current item id for newly created item, using REST API and JQuery.
 We are having a requirement to store the current item id in a Field, once we clicked on the custom save button.
We are having filed with name “RequestID” and couple of fields and having a custom button.
Call this function on “getNewRequestItemID” button click and use the below code.

<script type="text/javascript" src="/Dotnetsharepoint/SP2013/SiteAssets/jquery-1.11.0.min.js"></script>
<script type="text/javascript">
$(function () {
 var listname = "YOURLISTNAME";

function getNewRequestItemID(listname){
var currentitemid=0;
var siteURL = _spPageContextInfo.webAbsoluteUrl;
 var url = siteURL + "/_api/web/lists/getbytitle('" + listname + "')/items?$select=ID&$OrderBy=ID desc&$top=1";
 url: url,
 method: "GET",
 async: false,
 headers: { "Accept": "application/json; odata=verbose" },
 success: function (data) {
        currentitemid = data.d.results[0].ID;
  $("input[title = 'RequestID']").val(currentitemid);
 error: function (data) {      
 get the current item id for newly created item in SharePoint using javascript

Microsoft Flow Features

Create automated workflows between your favorite apps and services to get notifications, synchronize files, collect data, and more.
Flow app in SharePoint Office 365
Now Microsoft Flow supporting 90 services. SharePoint, OneDrive for Business, Dynamics 365, OneDrive, SQL Server..Reference:             
New Features:
 Search by service
Users will be able to see all the triggers from a service by simply selecting that service. Also, once a trigger is selected, the same process can be done to add an action, as can be seen in the following screenshots.

Switch Case
It is an important addition to the already available nested conditionals support, and it "will make it very easy to have parallel branches of conditional logic based on a single value".
You can find switch by selecting the More … option after selecting New Step and then choosing Add a Switch Case. Inside a Switch Case you will select a value from the trigger or a previous step to switch on.
Office 365 and services
Trigger when an email is flagged – for example, you can now automatically create a task in Todoist (or Wunderlist) whenever you flag an email in Outlook
Flag an email as an action – create filters to flag emails – for example, automatically flag emails that come from your manager
Move an email to another folder – you can also automatically move emails between folders
Connect to Local or Network File Systems and Stripe
Flow can now connect to your Local File System or a Network File System. You can log or copy files from your own local Windows desktop PC to the cloud. Likewise, if you have a team Network Share, you can connect to that from Microsoft Flow.
Finally added four other Premium services: 

You can now use Stripe from Microsoft Flow. Stripe allows private individuals and businesses to accept payments over the internet. You can track customers, orders, invoices  and more. 

 Microsoft Flow integrates with Informix and DB2 so you can connect to resources stored in IBM Informix or IBM DB2 databases. We support SELECT, INSERT, UPDATE, and DELETE operations.

     UserVoice is a product management and customer support tool that allows businesses to build a suggestions portal for their users to submit feature ideas, build a ticketing system for customer support and build articles knowledge base for users.

Delete SharePoint list items based on particular view using PowerShell

In this article you can able to see how to delete  SharePoint list items based on the particular view and also having another condition how have to delete items on every Monday, we created a couple of views what type of data have to delete based on item created date.
One view is used to delete SharePoint list items every day and another delete only on Monday.

Note:  by default list item limit is 30 items, we have to modify the view based on the requirement I change to 5000 so every day it will delete only 5000 items to delete.

add-pssnapin microsoft.sharepoint.powershell
$web = get-spweb -identity ""
$MainList = $web.lists["DeleteListItems"];
$today = (get-date).DayOfWeek
if($today -eq "Monday")
$view = $MainList.Views["DeleteMondaylistitems"];
$view = $MainList.Views["DeleteEverydaylistitems"];
$items = $MainList.GetItems($view)
$totalcount = $items.Count
$j = 0;
for($i = $totalcount -1; $i -ge 0; $i--)
$deleteitem = $items[$i]
write-host $deleteitem.ID

How to add blank value to choice field in SharePoint

As per my requirement I want to show blank value in choice field, but SharePoint won’t take space as a valid option. So we can use ASCII code.
Method1: We can use Unicode character that does not print nothing. I tried with U+205F & it’s working as expected. To use this character please check the below steps.
1.    Navigate to Start -> run -> charmap

It will open Character Map Window.
Choose Font: Calibri, Drag down the cursor & select black check the code finally click copy the code

Paste the code in choice field and save.

Now check blank field. 

It’s working as expected.
Method 2: Use ASCII code 0129. It is empty character that SharePoint will accept as a valid option. It will appears empty on dropdown list. Hold down the ALT key and type the number 0129