Wednesday, June 24, 2015

Create SiteCollection Using Powershell

$homeUrl = read-host "Enter WebApplication URL"
$managepath = read-host "Enter site collection relative path here including any managed path. Managed path needs to be existing"
$scName = read-host "Enter site collection name here"
$sitesHomeUrl = $homeUrl + $managepath + "/" + $scName
$primaryOwner = read-host "Enter primary owner account here"
$secondaryOwner = read-host "Enter scondary owner account here"
$contentDatabaseName = read-host "Enter content database name here"
$contentDatabaseServerName = read-host "Enter database server name here"
$templateName = "BLANKINTERNETCONTAINER#0"

#Create new content database
New-SPContentDatabase -Name $contentDatabaseName -DatabaseServer $contentDatabaseServerName -WebApplication $homeUrl
#Create new site collection
write-host $sitesHomeUrl;
New-SPSite -Url $sitesHomeUrl -OwnerAlias $primaryOwner -SecondaryOwnerAlias $secondaryOwner -ContentDatabase $contentDatabaseName -Template $templateName

Tuesday, June 9, 2015

Get list guid using SPServices

function GetListId(listName) {
var id = "";
$().SPServices({
operation: "GetList",
listName: listName,
async: false,
completefunc: function (xData, Status) {
id = $(xData.responseXML).find("List").attr("ID");
}
});
return id;

Monday, June 8, 2015

Reuse loader image in SharePoint 2013

oLoader = SP.UI.ModalDialog.showWaitScreenWithNoClose(SP.Res.dialogLoading15);

oLoader.close();

How to launch a document by clicking a link to the file?

Word: <a href='ms-word:ofe|u|path/to/web/word/document.docx'>Link to document</a> Excel: <a href='ms-excel:o...