This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ClientContext clientcontext = new ClientContext(sitecollection); | |
clientcontext.Credentials = Credentials; | |
var page = Microsoft.SharePoint.Client.File.OpenBinaryDirect(clientcontext, "/Sites/Vard/SitePages/Home.aspx"); | |
StreamReader reader = new StreamReader(page.Stream); | |
string pageHTML = reader.ReadToEnd(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<CustomAction Location="ScriptLink" ScriptBlock="document.write('<link rel="stylesheet" type="text/css" href="/SiteAssets/Styles/mystyles.css"></' + 'link>');" Sequence="5000" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override void FeatureActivated(SPFeatureReceiverProperties properties) | |
{ | |
//Add the Css to the current Web | |
SPSite site = properties.Feature.Parent as SPSite; | |
SPWeb web = site.OpenWeb(); | |
if (web.ServerRelativeUrl == "/") | |
{ | |
web.AlternateCssUrl = web.ServerRelativeUrl + "SiteAssets/Styles/mystyles.css"; | |
} | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loadCOM = () -> | |
context = new SP.ClientContext.get_current() | |
web = context.get_web() | |
context.load web | |
context.executeQueryAsync -> | |
#Success Callback | |
alert web.get_title() | |
, (sender,args)-> | |
#Failure CallBack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Create a new Button | |
myButton = $("<input id='cfLink' type='button' value='Click Me'/>") | |
#Assign a click function to the button which sends the button itself as the first parameter | |
myButton.click -> linkClicked (this) | |
#Push myLink into the DOM after the ribbon container. | |
$("#s4-ribbonrow").after myButton | |
#When this function is called, alert the value attribute of the button. | |
linkClicked = (button) -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#The initCoffee function has one required paramter (firstname) and one optional paramter (lastname) whose default valu has been provided. | |
initCoffee = (firstname, lastname="deshpande") -> | |
#You can include wildcards whithin a string so you dont have to concatenate various strings together. | |
alert "Hi #{firstname} #{lastname}! Welcome to CoffeeScript Demo on SharePoint" | |
#Call the initCoffee function with passing only one parametre. | |
initCoffee("vardhaman") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AddItem = () -> | |
context = new SP.ClientContext.get_current() | |
list = context.get_web().get_lists().getByTitle "CoffeeList" | |
listItemCreateInfo = new SP.ListItemCreationInformation | |
listItem = list.addItem listItemCreateInfo | |
listItem.set_item "Title","Mocha" | |
listItem.update(); | |
context.executeQueryAsync -> | |
#Success Callback | |
alert "Item Added" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UpdateItem = () -> | |
context = new SP.ClientContext.get_current() | |
list = context.get_web().get_lists().getByTitle "CoffeeList" | |
listItem = list.getItemById 1 | |
listItem.set_item "Title", "Latte" | |
listItem.update(); | |
context.executeQueryAsync -> | |
#Success Callback | |
alert "Item Updated" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DeleteItem = () -> | |
context = new SP.ClientContext.get_current() | |
list = context.get_web().get_lists().getByTitle "CoffeeList" | |
listItem = list.getItemById 1 | |
listItem.deleteObject(); | |
context.executeQueryAsync -> | |
#Success Callback | |
alert "Item Deleted" | |
, (sender,args)-> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GetItems = () -> | |
context = new SP.ClientContext.get_current() | |
list = context.get_web().get_lists().getByTitle "CoffeeList" | |
listItems = list.getItems '' | |
context.load listItems | |
context.executeQueryAsync -> | |
#Success CallBack | |
itemEnum = listItems.getEnumerator() | |
alert itemEnum.get_current().get_item "Title" while itemEnum.moveNext() | |
OlderNewer