How to provision site collection using CSOM in SharePoint on premise
Hi,
I need to create site collection using CSOM in SharePoint on premise.
Most of the forums discuss on provisioning site collection in SharePoint online and that does not work in on premises.
Is it possible to provision site collection using CSOM in on premise?
Kindly, share some reference to accomplish this.
Thanks in advance,
Dhijit
Hi,
According to your description, my understanding is that you want to create a site collection using Client Object Model in SharePoint on-premise environment.
One option is that you can follow the article below to create the site collection with CSOM.
Provisioning site collections using SP App model in on-premises with just CSOM
Another option, I suggest you can use admin web service for SharePoint 2013 to create a site collection.
Here is a detailed article for your reference:
Admin.CreateSite method
Thanks
Best Regards
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected]
Similar Messages
-
Setting SharingCapability property for a Site Collection using CSOM in C#
Hello,
I am trying to deploy multiple site collections in a SharePoint 2013 Online tenant, using CSOM in C#.
I am currently using the SiteCreationProperties to do this, but I miss one crucial parameter : SharingCapability.
Do you guys know a way of activating external sharing for a site collection in CSOM ?I believe you can set the SharingCapability of the Site after you create it. You can use the Microsoft.Online.SharePoint.TenantAdministration.Tenant.GetSitePropertiesByUrl(siteUrl, true)
This returns SiteProperties object with a SharingCapability property you can set with the appropriate enumeration. Then call the Update method.
http://msdn.microsoft.com/en-us/library/microsoft.online.sharepoint.tenantadministration.tenant.getsitepropertiesbyurl(v=office.15).aspx
Blog | SharePoint Field Notes Dev Tools |
SPFastDeploy | SPRemoteAPIExplorer -
How to extract audit log data from every document library in site collection using powershell?
Hi All,
I have n number of document library in one site collection,
My query is- How to extract audit log data from every document library in a site collection using powershell?
Please give solution as soon as possible?Hi inguru,
For SharePoint audit log data, These data combine together in site collection. So there is no easy way to extract audit log data for document library.
As a workaround, you can export the site collection audit log data to a CSV file using PowerShell Command, then you can filter the document library audit log data in Excel.
More information:
SharePoint 2007 \ 2010 – PowerShell script to get SharePoint audit information:
http://sharepointhivehints.wordpress.com/2014/04/30/sharepoint-2007-2010-powershell-script-to-get-sharepoint-audit-information/
Best Regards
Zhengyu Guo
TechNet Community Support -
Creating new site collection using wsp template fails
Hi all,
I'm creating new site collections using a wsp solution generated by "save as template".
For site collection creation I select "<Select template later>" then I upload the wsp solution.
Everything worked until last month, now after CU installation (agoust 2014) I get an error:
"List does not exist. The page you selected contains a list that does not exist. It may have been deleted by another user."
Does anyone know how to solve it?
Thanks
MaurizioULS contains a lot of those errors:
System.IO.FileNotFoundException: <nativehr>0x80070002</nativehr><nativestack></nativestack>,
StackTrace:
in Microsoft.SharePoint.SPWeb.GetList(String strUrl)
in Microsoft.SharePoint.SPWeb.TryGetListByUrl(String url)
in Microsoft.SharePoint.SPFieldElement.PerformFixUpIfLookUpField(Guid fieldId, XmlNode xmlNodeOfAField, SPWeb web)
in Microsoft.SharePoint.SPFieldElement.ElementActivated(SPFeaturePropertyCollection props, SPSqlCommand sqlcmdAppendOnly, SPWebApplication webApp, SPSite site, SPWeb webNull, Boolean fForce)
in Microsoft.SharePoint.Administration.SPElementDefinitionCollection.ProvisionFieldsAndContentTypes(SPFeaturePropertyCollection props, SPSite site, SPWeb web, SPFeatureActivateFlags activateFlags, Boolean fForce)
in Microsoft.SharePoint.Administration.SPElementDefinitionCollection.ProvisionElements(SPFeaturePropertyCollection props, SPWebApplication webapp, SPSite site, SPWeb web, SPFeatureActivateFlags activateFlags, Boolean fForce)
in Microsoft.SharePoint.SPFeature.Activate(SPSite siteParent, SPWeb webParent, SPFeaturePropertyCollection props, SPFeatureActivateFlags activateFlags, Boolean fForce)
in Microsoft.SharePoint.SPFeatureCollection.AddInternal(SPFeatureDefinition featdef, Version version, SPFeaturePropertyCollection properties, SPFeatureActivateFlags activateFlags, Boolean force, Boolean fMarkOnly)
in Microsoft.SharePoint.SPFeatureCollection.AddInternalWithName(Guid featureId, Int32 compatibilityLevel, String featureName, Version version, SPFeaturePropertyCollection properties, SPFeatureActivateFlags activateFlags, Boolean force, Boolean
fMarkOnly, Boolean fIgnoreMissing, SPFeatureDefinitionScope featdefScope)
in Microsoft.SharePoint.SPFeatureManager.EnsureFeaturesActivatedCore(SPSite site, SPWeb web, String sFeatures, Boolean fMarkOnly, Boolean fIgnoreMissing)
in Microsoft.SharePoint.SPFeatureManager.<>c__DisplayClass7.<EnsureFeaturesActivatedAtWeb>b__6()
in Microsoft.SharePoint.SPSecurity.RunAsUser(SPUserToken userToken, Boolean bResetContext, WaitCallback code, Object param)
in Microsoft.SharePoint.SPFeatureManager.EnsureFeaturesActivatedAtWeb(Byte[]& userToken, Guid& tranLockerId, Int32 nZone, Guid databaseid, Guid siteid, Guid webid, String sFeatures, Boolean fIgnoreMissing)
in Microsoft.SharePoint.Library.SPRequestInternalClass.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, Int32 fIgnoreMissingFeatures, String&
bstrWebTemplate, Int32& plWebTemplateId)
in Microsoft.SharePoint.Library.SPRequestInternalClass.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, Int32 fIgnoreMissingFeatures, String&
bstrWebTemplate, Int32& plWebTemplateId)
in Microsoft.SharePoint.Library.SPRequest.ApplyWebTemplate(String bstrUrl, String bstrWebTemplateContent, Int32 fWebTemplateContentFromSubweb, Int32 fDeleteGlobalListsWithWebTemplateContent, Int32 fIgnoreMissingFeatures, String& bstrWebTemplate,
Int32& plWebTemplateId)
in Microsoft.SharePoint.SPWeb.ProvisionWebTemplate(SPWebTemplate webTemplate, String webTemplateToUse, SPFeatureWebTemplate featureWebTemplate, Page page, SPFeatureDependencyErrorBehavior featureDependencyErrorBehavior, ICollection`1&
featureDependencyErrors)
in Microsoft.SharePoint.SPWeb.ApplyWebTemplate(SPWebTemplate webTemplate, Page page, SPFeatureDependencyErrorBehavior featureDependencyErrorBehavior, ICollection`1& featureDependencyErrors)
in Microsoft.SharePoint.SPWeb.ApplyWebTemplate(String strWebTemplate) -
How to access site collection with a different name?
Hello,
I have a web application with an URL like http://testsite. And, it has a site collection
named http://testsite.
Can I have another site collection using the same web application like http://testsite/site and use alternative access mappings to map it to http://companysite?
Is this possible?
Thanks
PaulHi Paul,
According to your description, my understanding is that you want to map the non-root site collection from
http://testsite to http://companysite .
For your issue, it cannot be achieved by using Alternative Access
Mappings. For achieving your demand, you can create host-named site collection instead of path-based site collection.
For more information, you can refer to the blog:
http://technet.microsoft.com/en-us/library/cc424952(v=office.15).aspx
http://blogs.msdn.com/b/russmax/archive/2013/10/31/guide-to-sharepoint-2013-host-name-site-collections.aspx
Best Regards,
Eric
Eric Tao
TechNet Community Support -
Delete site collection using Client object model
Is it possible to delete a site collection using Client object model?
-PrashantI don't think you can create or delete a site-collection using SharePoint Client Object Model. You'd need to leverage admin web services (
http://Site/_vti_adm/Admin.asmx) (or) server-side object model (or) powershell for this task.
Please mark the replies as answers if they help or unmark if not. -
How to retrive latest items from different site collection using content search web part
I have a web application that contains two site collections(team site + enterprise wiki), with the following URLs:-
-http://applicationname/teamsite
-http://applicationname/enterprisewik
Now I need to display the latest 10 wiki pages that are inside the enterprise wiki site collection (according to the modified date) inside the team site. So I read that using Content search web part allows for cross-site content query.
So I added a new content search web part , inside my team site, and I click on “change query” button. But I am not sure how I can reference the enterprise wiki site collection's library and to specify that I need to get the latest 10 wiki pages using the
content search web part's query dialog box? Can anyone advice please ?
ThanksEdit the webpart and click change query in search criteria. click on switch to advanced mode and enter your path:
(path:"http://applicationname/teamsite" OR path:"http://applicationname/enterprisewik")
you can specify sorting by created date and click ok. in number of items to show, type 10. this should fulfill your requirement.
For further reading, here are some links:
http://office.microsoft.com/en-001/office365-sharepoint-online-enterprise-help/configure-a-content-search-web-part-in-sharepoint-HA104119042.aspx
http://blogs.technet.com/b/tothesharepoint/archive/2013/04/30/stage-9-configure-the-
query-in-a-content-search-web-part-on-a-category-page.aspx
http://blogs.technet.com/b/tothesharepoint/archive/2013/05/23/stage-10-configure-the-query-in-a-content-search-web-part-on-a-catalog-item-page.aspx
kashif -
How to get the user created at and modified at properties for a site collection using powershell
Hi guys, I Know how to get the list of users of a site collection by Get-SPUser cmdlet but hte problem is that this cmdlet doesnt give me the user Created at and modifed at properties
can any one tell me how to get these values via powershell????
ps: ignore the 2013 screenshot.. i just want a way to get those values .. if you provide me solution in either 2010 or 2013 , i will crack the other..
plz guys help me ...Get the User Information list and then get the user from that list
$web = Get-SPWeb "siteUrl"
$userInfoList = $web.SiteUserInfoList
$userItem = $userInfoList.Items[0]; #0 here is just for demonstration. You take the user you want here or loop through all users.
$created = $userItem["Created"]
$modified = $userItem["Modified"] -
Hi,
I am trying to fetch properties of all lists of "Survey Type" from my site collection in SharePoint 2013 using script editor web part. I am able to fetch properties of one list by mentioning its name explicitly in code but not all survey
list.
My task is to display Survey name , description ,Time created and URLs of all survey lists using java script in script editor web part.
And let me know , if there is any other OOB feature of SharePoint 2013 to achieve the same.
Here is the code :
<script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', sharePointReady);
function sharePointReady() {
GetSurveyList();
function GetSurveyList() {
var spListTitle = " List Name";
var clientContext = new SP.ClientContext.get_current();
var oWeb = clientContext.get_web();
this.surveyList = oWeb.get_lists().getByTitle(spListTitle);
clientContext.load(surveyList);
clientContext.executeQueryAsync(Function.createDelegate(this, this.GetListProperties),Function.createDelegate(this, this.onFailure));
function GetListProperties() {
$("#SurveyList").text("");
var surveyTable = "<table border=1>";
surveyTable = surveyTable.concat("<tr><td>Survey Name</td>");
surveyTable = surveyTable.concat("<td>Survey Description</td>");
surveyTable = surveyTable.concat("<td>Time Created</td>");
surveyTable = surveyTable.concat("<tr><td>" + surveyList.get_title() + "</td>");
surveyTable = surveyTable.concat("<td>" + surveyList.get_description() + "</td>");
surveyTable = surveyTable.concat("<td>" + surveyList.get_created().format("MM/dd/yyyy hh:mm tt")+ "</td>");
surveyTable = surveyTable.concat("</table>");
$("#SurveyList").append(surveyTable);
function onFailure(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
</script>
<div id="SurveyList"></div>Shifa,
Please use search result webpart or content query webpart to list all survey list.
Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply. -
Unable to upload Files to child site collection using REST
Dear All,
I referred this article http://www.shillier.com/archive/2013/03/26/uploading-files-in-sharepoint-2013-using-csom-and-rest.aspx for uploading documents to SP Document Library and it works fine for any document library under the root site collection(
for example "http://<server name>/Shared Documents" but when i upload the same document to one of the sub site collection created using Managed Path( the site collection path is "http://<server name>/files/Case" and the library
name is "records") it fails and i get below error:
The security validation for this page is invalid. Click Back in your
Web browser, refresh the page, and try your operation again, Error Code -2130575251 Microsoft.SharePoint.SPException"
Any help suggestion to resolve this? I've almost tried everything to resolve this issue but no luck.. appreciate any help
for this..
Regards,
VishalHi,
According to your post, my understanding is that you had an issue uploading files to subsite using REST.
I had made a simple code demo below, it will upload a file to Document Library after you make your selection with the File control.
<script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
function uploadFile(){
//alert(2);
if (document.getElementById("file").files.length === 0) {
alert('No file was selected');
return;
var parts = document.getElementById("file").value.split("\\");
var filename = parts[parts.length - 1];
var file = document.getElementById("file").files[0];
uploadFileSync("http://YourSite", "Documents", filename, file);
//Upload file synchronously
function uploadFileSync(spWebUrl , library, filename, file)
//alert(3);
var reader = new FileReader();
reader.onloadend = function(evt)
if (evt.target.readyState == FileReader.DONE)
var buffer = evt.target.result;
var completeUrl = spWebUrl
+ "/_api/web/lists/getByTitle('"+ library +"')"
+ "/RootFolder/Files/add(url='"+ filename +"',overwrite='true')?"
+ "@TargetLibrary='"+library+"'&@TargetFileName='"+ filename +"'";
$.ajax({
url: completeUrl,
type: "POST",
data: buffer,
async: false,
processData: false,
headers: {
"accept": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"content-length": buffer.byteLength
complete: function (data) {
//uploaded pic url
console.log(data.responseJSON.d.ServerRelativeUrl);
error: function (err) {
alert('failed');
reader.readAsArrayBuffer(file);
</script>
<input type="file" id='file' onchange="uploadFile()"/>
Thanks,
Jason
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected].
Jason Guo
TechNet Community Support -
How to deploy site collection has sub sites to other environments
Hello everybody,
I have a site collection SharePoint online.
In the site, haven 3 sub sites.
Now, i want to deploy this site to other environment,
How can i do that?
I am trying save site as template but that is not support sub site.
Thanks and best Regards,
QuyenPVHi,
According to your post, my understanding is that you want to backup SharePoint online site to another environment.
For SharePoint server, we can use the PowerShell to backup the site collection with all the subsites.
However, per the technet article below, there is no backup and restore cmdlets for SharePoint online to backup and restore.
http://technet.microsoft.com/en-us/library/fp161374.aspx
You can use the third-party tool to achieve this scenario.
http://blogs.technet.com/b/akieft/archive/2012/01/09/restore-options-in-sharepoint-online.aspx
As this is the forum for SharePoint server on-premise, I’m not familiar with the SharePoint online, for this issue, I recommend you can post a new question in the forum for Office 365/SharePoint online.
http://community.office365.com/en-us/forums/154.aspx
More experts will assist you, then you will get more information relation to SharePoint Online.
Thank you for your understanding and support.
Thanks & Regards,
Jason
Jason Guo
TechNet Community Support -
How to get site permissions using power shell ?
Hello,
I require to get list of granted permissions ( Group/users ) which we see from Site Actions > Site Permissions.
would you please let me know how can I fetch the same using power shell ?
Thanks and Regards,
Dipti ChhatrapatiHello,
I have found the same using following script :
if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) {
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
#Define variables
$site = Get-SPSite "Site collection URL"
#Get all subsites for site collection
$web = $site.AllWebs
#Loop through each subsite and write permissions
foreach ($web in $web)
if (($web.permissions -ne $null) -and ($web.hasuniqueroleassignments -eq "True"))
Write-Output "****************************************"
Write-Output "Displaying site permissions for: $web"
$web.permissions | fl member, basepermissions
elseif ($web.hasuniqueroleassignments -ne "True")
Write-Output "****************************************"
Write-Output "Displaying site permissions for: $web"
"$web inherits permissions from $site"
Write-Host "Finished."
$site.dispose()
$web.dispose()
Hope it helps others !
Thanks and Regards,
Dipti
Dipti Chhatrapati -
Retrieve all pages in a site collection using powershell command
Hi all,
I need to retrieve all pages in a site collection and i wanted to display it in a csv file using powershell command.Please help.
Regards,
PraveenHi Praveen,
Here are two blogs would be helpful:
PowerShell script to Enumerate Sites, Sub-sites and print them in a .csv file
http://www.sharepointfix.com/2012/02/powershell-script-to-enumerate-sites.html
Powershell to Loop through all SharePoint sites and pages
https://tjendarta.wordpress.com/2013/03/19/powershell-to-loop-through-all-sharepoint-sites-and-pages/
Best Regards
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
How to update user properties using CSOM
Hello All ,
Is it possible to update a SharePoint user properties (like email, title, etc) using CSOM API? In the User class (Microsoft.SharePoint.Client.User) i saw properties like Email, Title are possible to get and set. I tried updating these properties through code
like below, but it is not getting updated in SharePoint. Is there any alternative way?
String updateUser= "john alex";
User user1 = web.EnsureUser(updateUser);
user1.Email = "[email protected]";
clientContext.Load(user1);
clientContext.ExecuteQuery();
Regards
ShahabasYou are not calling the update on the user object. Here is an example:
String updateUser= "john alex";
User user1 = web.EnsureUser(updateUser);
user1.Email = "[email protected]";
user1.Update();
clientContext.Load(user1);
clientContext.ExecuteQuery();
Nadeem Yousuf -
How to change Site Share mail template in SharePoint online (Office 365)
Hi,
I want to change the default mail template used in SharePoint Online (Office 365) which is as follows
I want to change the logo of microsoft with my custom logo and message below that logo.
How could i do that?in Office365 SharePoint Online, if you wan to customize the alert template you need to customize the Alerttemplates.xml under 14 folder on Online server, but it is not permitted, check this article you
also have seen.
You can also post this question related SharePoint Online in dedicated Office365 SharePoint Online forum, you can get a better assistance there,
http://community.office365.com/en-us/forums/151/categories.aspx
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/0d31bb5d-d46b-425a-9f48-6100404b95d8/sharepoint-online-custom-alert-emails?forum=sharepointcustomizationprevious
Maybe you are looking for
-
I just bought a Y2P in Sweden and there is no Yoga Chef installed in the laptop and neither can I find it somewhere. Anyone noticed this also?
-
Buying a configured macbook pro
I want to upgrade my mid 2010 macbook pro to a 2013 macbook pro with retina display. As I was checking out the available configurations for the mbp I noticed the option to change the keyboard language. I was wondering if I chose the Arabic keyboard,
-
How refresh JProgressBar display ?
I use a JProgressBar in my program but the display of it is never refresh even if I use updateUI method. Do you know a way to have a real refresh of my display ?
-
Replacement of Tax Columns in R12 Environment (12.1.3)
After Upgrade from 11.5.10 to R12.1.3 these following columns were picked in AP_INVOICE_DISTRIBUTIONS_ALL table and now the issue is about to replace these tax columns with R12 ZX tables. Table used in 11i AP_INVOICE_DISTRIBUTIONS_ALL TAX_RECOVERY_RA
-
I need to change this for all of our users and have created this script so far. Does anyone know how to Allow for all devices? $mailboxes = Get-casMailbox -Filter {hasactivesyncdevicepartnership -eq $true -and -not displayname -like "CAS_{*"} | Ge