Friday, December 6, 2013
Saturday, November 30, 2013
Adding Item to SharePoint list using Jquery and SPServices
In this article I am going to show how to add list item to a SharePoint list using Jquery.
Prerequisites:
1. Create a SharePoint list (in my case I just created a list with name "testlist")
2. create a new page and insert a content editor webpart.
3. By default my "testlist" is created with Title field, so to make this article simple, I will be adding only Title filed from Jquery.
4. Now add below code to content editor webpart in Edit Source Mode
Prerequisites:
1. Create a SharePoint list (in my case I just created a list with name "testlist")
2. create a new page and insert a content editor webpart.
3. By default my "testlist" is created with Title field, so to make this article simple, I will be adding only Title filed from Jquery.
4. Now add below code to content editor webpart in Edit Source Mode
TODO:
Place one HTML textbox to enter the title and One button to add the text box value to list when clicked.
HTML:
<table>
<tr>
<td><strong>List Item to be added</strong></td>
<td><input id="txtTitle" name="txtTitle" type="text" /></td>
</tr><tr>
<td><input name="ADD" id="btnADD" type="submit" value="Add Item to List" /></td></tr>
</table>
In order to work with Jquery and Sharepoint add below references for Jquery or download the files online and refer from your style library.
I will be referring online jquery.
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.10.2.js "></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery.SPServices-0.7.2.js "></script>
Script :
<script type="text/javascript">
$(document).ready(function () {
$("#btnAdd").click(function () {
var title = $("#txtTitle").val();
AddListItem(title);
});
});
function AddListItem(TitleField) {
$().SPServices({
operation: "UpdateListItems",
async: false,
batchCmd: "New",
listName: "testlist",
valuepairs: [["Title", TitleField]],
completefunc: function (xData, Status) {
alert("Data Saved! and Please check your List");
}
});
}
</script>
<table>
<tr>
<td><strong>List Item to be added</strong></td>
<td><input id="txtTitle" name="txtTitle" type="text" /></td>
</tr><tr>
<td><input name="ADD" id="btnADD" type="submit" value="Add Item to List" /></td></tr>
</table>
In order to work with Jquery and Sharepoint add below references for Jquery or download the files online and refer from your style library.
I will be referring online jquery.
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.10.2.js "></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery.SPServices-0.7.2.js "></script>
Script :
<script type="text/javascript">
$(document).ready(function () {
$("#btnAdd").click(function () {
var title = $("#txtTitle").val();
AddListItem(title);
});
});
function AddListItem(TitleField) {
$().SPServices({
operation: "UpdateListItems",
async: false,
batchCmd: "New",
listName: "testlist",
valuepairs: [["Title", TitleField]],
completefunc: function (xData, Status) {
alert("Data Saved! and Please check your List");
}
});
}
</script>
Wednesday, October 30, 2013
SDDL String Contains an invalid SID or a SID that cannot be translated” ERROR During SHAREPOINT 2013 configuration wizard
Error : SDDL String Contains an invalid SID or a SID that cannot be translated” ERROR During SHAREPOINT 2013 configuration wizard 8th Step
Solution :
Browse to
1. "C:\Program Files\Microsoft Office Servers\15.0\Data\Office Server" folder
2. Right click on Analytics_cf2da844-a5ee-4a2a-898d-e800a936e434 (Analytics_GUID) folder
3.Share the folder as shown below
Solution :
Browse to
1. "C:\Program Files\Microsoft Office Servers\15.0\Data\Office Server" folder
2. Right click on Analytics_cf2da844-a5ee-4a2a-898d-e800a936e434 (Analytics_GUID) folder
3.Share the folder as shown below
Saturday, August 24, 2013
Power Shell script to delete SharePoint Property bag Values.
# Add Powershell Snapin
Add-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue
# Set the variable to removed from property bag
$RemovePropertyBag = "DBConString"
# Get the central admin URL to delete the Property bag value at farm level
$SiteUrl = Get-SPWebApplication -includecentraladministration | where { $_.DisplayName -eq "Sharepoint Central Administration v4" }
# Load Required Assemblies
[System.Reflection.Assembly]::Load("Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c")
[System.Reflection.Assembly]::Load("Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")
[System.Reflection.Assembly]::Load("Microsoft.Practices.SharePoint.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=ef4330804b3c4129")
$site = New-Object Microsoft.SharePoint.SPSite($SiteUrl.URL)
# Get Service locator context and config Manager to set the site context
$serviceLocator = [Microsoft.Practices.SharePoint.Common.ServiceLocation.SharePointServiceLocator]::GetCurrent()
$configManager = $serviceLocator.GetInstance([Microsoft.Practices.SharePoint.Common.Configuration.IConfigManager])
$configManager.SetWeb($site.RootWeb);
# Get Property Bag
$farmBag = $configManager.GetPropertyBag([Microsoft.Practices.SharePoint.Common.Configuration.ConfigLevel]::CurrentSPFarm)
# set the Value
$configManager.SetInPropertyBag($RemovePropertyBag, "", $farmBag)
write-host "Removing PropertyBag Values $RemovePropertyBag successful"
Add-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue
# Set the variable to removed from property bag
$RemovePropertyBag = "DBConString"
# Get the central admin URL to delete the Property bag value at farm level
$SiteUrl = Get-SPWebApplication -includecentraladministration | where { $_.DisplayName -eq "Sharepoint Central Administration v4" }
# Load Required Assemblies
[System.Reflection.Assembly]::Load("Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c")
[System.Reflection.Assembly]::Load("Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")
[System.Reflection.Assembly]::Load("Microsoft.Practices.SharePoint.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=ef4330804b3c4129")
$site = New-Object Microsoft.SharePoint.SPSite($SiteUrl.URL)
# Get Service locator context and config Manager to set the site context
$serviceLocator = [Microsoft.Practices.SharePoint.Common.ServiceLocation.SharePointServiceLocator]::GetCurrent()
$configManager = $serviceLocator.GetInstance([Microsoft.Practices.SharePoint.Common.Configuration.IConfigManager])
$configManager.SetWeb($site.RootWeb);
# Get Property Bag
$farmBag = $configManager.GetPropertyBag([Microsoft.Practices.SharePoint.Common.Configuration.ConfigLevel]::CurrentSPFarm)
# set the Value
$configManager.SetInPropertyBag($RemovePropertyBag, "", $farmBag)
write-host "Removing PropertyBag Values $RemovePropertyBag successful"
PowerShell Script to backup WSP from Central Admin's solution gallery
For a specific solution backup
$solution = Get-SPSolution $packageName -ErrorAction SilentlyContinue
# Get the File name from Solution file.
$filename = $solution.SolutionFile.Name
# script to get the location where the script is running -- folder location.
$BaseFolder = (Get-Location -PSProvider FileSystem).ProviderPath
# Save the file to Disk
$solution.SolutionFile.SaveAs("$BackupFolder\$filename")
To backup all the solutions from central admin' solution gallery
$BaseFolder = (Get-Location -PSProvider FileSystem).ProviderPath
$SPSolutions = get-spsolution
foreach($solution in $spsolutions)
{
$filename = $solution.SolutionFile.Name
$solution.SolutionFile.SaveAs("$BackupFolder\$filename")
}
Tuesday, August 13, 2013
Power Shell Script to Hide NewsFeed, Sites, Sky Drive top menu bar in SharePoint 2013
In order to hide the menu bar , We have to make below node text to empty by using PowerShell
i,e. Div tag shoud look like
TODO:
$WebApp = get-spwebapplication("Any Specific WebApp URL")
$WebApp.SuiteBarBrandingElementHtml = ""
$WebApp.Update()
This can be achieved using Java Script on Master Page or by editing the same in SharePoint designer.
i,e. Div tag shoud look like
TODO:
$WebApp = get-spwebapplication("Any Specific WebApp URL")
$WebApp.SuiteBarBrandingElementHtml = ""
$WebApp.Update()
This can be achieved using Java Script on Master Page or by editing the same in SharePoint designer.
Subscribe to:
Posts (Atom)
Time Intelligence Functions in Power BI: A Comprehensive Guide
Time intelligence is one of the most powerful features of Power BI, enabling users to analyze data over time periods and extract meaningful ...
-
example Python code to implement an email spam filter using the Naive Bayes algorithm: import os import numpy as np import pandas as pd ...
-
Error while crawling content source in SharePoint 2013 search. Resolution : Check the default search crawl account.
-
In machine learning, there are different types of label encoding techniques that can be used based on the nature of the data. Here are a fe...