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.

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


HTML Form 

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

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.


$(document).ready(function(){
mycallOuts();
});
<script>

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>'
         });
 
 });
 }
</script>

HTML Form 

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

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.


Solution:
Navigate to “permsetup.aspx” page in the same site, URL looks like
http://dotnetsharepoint.com/sites/sharepoint/documentsite/_layouts/15/permsetup.aspx

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.

Resolution:
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)
{
if([string]::isnullorwhitespace($computer))
{
}
else
{
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  "http://dotnetsharepoint.com/sites/SharePoint2013/BusinessUsers"
$groupss = $web.Groups.GetByName("DotNetSharePoint")
$emailgrouptoo =@()
foreach($user in $groupss.Users)
{
$sendemailto  =  $user.Email
$totalemail =  $sendemailto
  $emailgrouptoo+=$totalemail
 }
#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