Site content types and site columns were absent
hi,
i have seved a sub site as a template which includes 20+ doc libs with 20+ site content ctypes which includes 15+ site columns and then i have used this savedsite template in one site collection and implemented my
custom web parts and upload document fun. successfully.
now i have created another new site collection and forgot to create site content types and site columns as we have seen the site columns in the saved site template already.
now i realized that those site content types and site columns were not there but the strange thing is that i am able to uplaod the documents into those document libraries which are not associated with site content types, without any error.
Can I create the same in my new site collection ? since i have already created many many sub sites based on the saved site templates tested the functionality ,i dont wanna delete the template recreate all the sites again in order
to save the time.
Now pls advice:
1) if site columns / site contents were not existing at the site collection level, will this affect my func. in future?
2) is there any automated way fo creating site columns, site content types, associateing these site content types with doc libs programmatically like power shell/ sp object model API.
3) would like to any programmatic way of creating hundreds of sub sites based on the saved site templates in myw eb application/ site collection.
Hi,
We can create site columns, site content types or sub-sites using SharePoint Server Object Model.
The following articles for your reference:
SharePoint 2010: Create Site Columns and Content Types using C#.Net
http://social.technet.microsoft.com/wiki/contents/articles/20267.sharepoint-2010-create-site-columns-and-content-types-using-c-net.aspx
How to: Add a Content Type to a SharePoint List
http://msdn.microsoft.com/en-us/library/office/aa543576(v=office.14).aspx
Create Sites Using Custom Site Templates in SharePoint 2010
http://www.c-sharpcorner.com/UploadFile/63e78b/create-sites-using-custom-site-templates-in-sharepoint-2010/
How to create sub site with custom site template through PowerShell
http://fangdahai.blogspot.com/2012/08/how-to-create-sub-site-with-custom-site.html
Best regards
Dennis Guo
TechNet Community Support
Similar Messages
-
I have two different Site Asset libraries. The Site Asset Picture library has items of
content type picture. The Site Asset Image Library has items of
content type image.
1) I do not quite understand the different between a picture content type versus an image content type.
2) the thumbnail and preview columns do not display the image in the Site Asset
Image Library. (the image does display in the thumbnail column of the Site Asset Picture library.) I expected the image to display in the Site Asset Image Library the same as it does in the Site Asset Picture library.
Why doesn't it?
Betty
Betty StolwykI have subsequently found out that our "Site Asset Images" library is a Document Library to which someone must have replaced the Document content type with an Image content type. I also found out that picture previews/thumbnails cannot be displayed
in Document libraries. So the problem was the library type, not the content type.
So I simply created a new Picture Library (whose content type = picture) and copied the files into that and the thumbnails displayed just fine!
I bet what led to this is the default "Site Assets" library that is created for a new Team site. It is just a document library but sounds very similar to the "Assets" library. I can imagine someone thinking the "Site Assets" library was a standard
container for images, and simply changed the name to better identify the content!
As far as 'image' vs 'picture' content types, I noticed that a new Picture Library contains a content type of 'picture', but an Asset Library contains a content type of 'image' (as well as audio and video). Although the 'image' content type has a few
more fields than the 'picture' content type (picture content type does not have thumbnail), the actual Picture Library contains pretty much all the same fields, including the thumbnail. So for all practical purposes, either library type can be used for
storage of pictures. I am guessing that the Pictures Library which uses the picture content type is for backwards compatibility purposes, and that the 'image' content type is newer, being derived from the new "Rich Media Asset" content type and used
in the new Asset Library which can hold audio and video in addition to pictures.
Microsoft Help also mentioned that a Picture Library has a slide view which an Asset library does not. So my take on that is that if you want the potential of seeing your pictures as a slide show, put them in a Picture library which is still using
the 'picture' content type of previous SharePoint versions. If you want to keep pictures organized with audio/video files, then put them into an Asset library which uses the 'image' content type derived from the new Rich Media Asset content type.
Betty Stolwyk -
What are the drawbacks to adding a Site Content Type to the Document Site Column?
I have a client who has enough SharePoint knowledge to be dangerous.
They are requesting that a Column be added to all Document Libraries everywhere. We built a solution that would require a bit of work when a Site Collection is created, and it would require that we run a script to identify if there are any Libraries
that do not have this Column attached.
This client wants to know why we didn't just add this Column to the default Document Site Content Type. I don't know specifics as to why that's not a good idea, just that it's not a good idea.
Can anyone point me to a resource that identifies the reasons why this is not recommended?
Thank youI'd say there's a risk that patches or upgrades could be affected by this, or overwrite the change.
In the past I've derived a Company specific Document Content Type from the Base Document CT, and added any new company wide columns to that new CT.
w: http://www.the-north.com/sharepoint | t: @JMcAllisterCH | YouTube: http://www.youtube.com/user/JamieMcAllisterMVP -
SharePoint 2013 Custom Content Type with Site Column custom validations
Hello,
Can somebody please suggest me how I can create custom content type with site columns with custom validation to site columns programmatically?
Thanks,
Praveen Kumar PadmakaranHi,
From your description, my understanding is that you want to create content type with site column with validation.
You could create a site column, and add some validation to the site column. After you could create a custom content type, please add the site column with validation to the content type. Please refer
to this code below:
static void Main(string[] args)
// replace your url
using (SPSite site = new SPSite("http://sp/sites/sp2013"))
using (SPWeb web = site.OpenWeb())
//define the type of the field
SPFieldType type = SPFieldType.Number;
// create a site column
SPField field = CreateSiteColumn(web, "newTest", type, "");
// add custom formula for the field
SPFieldNumber fieldNumber = web.Fields.GetField("newTest") as SPFieldNumber;
fieldNumber.ValidationFormula = "=[newTest]>5";
fieldNumber.ValidationMessage = ">5";
fieldNumber.Update();
SPContentTypeId parentItemCTypeId = web.ContentTypes[0].Id;
// create custom content type
SPContentType contentType = CreateSiteContentType(web, "newContent", parentItemCTypeId, "Custom Content Types");
// add the site column to the content type
AddFieldToContentType(web, contentType, field);
// add fiedl to contenttype
public static void AddFieldToContentType(SPWeb web, SPContentType contentType, SPField field)
if (contentType == null) return;
if (contentType.Fields.ContainsField(field.Title)) return;
SPFieldLink fieldLink = new SPFieldLink(field);
contentType.FieldLinks.Add(fieldLink);
contentType.Update();
// create a custom content type
public static SPContentType CreateSiteContentType(SPWeb web, string contentTypeName,SPContentTypeId parentItemCTypeId, string group)
if (web.AvailableContentTypes[contentTypeName] == null)
SPContentType itemCType = web.AvailableContentTypes[parentItemCTypeId];
SPContentType contentType =
new SPContentType(itemCType, web.ContentTypes, contentTypeName) { Group = @group };
web.ContentTypes.Add(contentType);
contentType.Update();
return contentType;
return web.ContentTypes[contentTypeName];
// create a site column
public static SPField CreateSiteColumn(SPWeb web, string displayName,SPFieldType fieldType, string groupDescriptor)
if (!web.Fields.ContainsField(displayName))
string fieldName = web.Fields.Add(displayName, fieldType, false);
SPField field = web.Fields.GetFieldByInternalName(fieldName);
field.Group = groupDescriptor;
field.Update();
return field;
return web.Fields[displayName];
You could refer to these articles:
C# code to create Site Column, Content Type, and add fields to Content Type
http://spshare.blogspot.jp/2013/10/c-code-to-create-site-column-content.html
How to do custom validation for site column in SharePoint
http://www.c-sharpcorner.com/uploadfile/anavijai/how-to-do-custom-validation-for-site-column-in-sharepoint/
Best Regards,
Vincent Han
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]. -
Creating the site content type failed when publish Infopath form to Sharepoint 2013
I have an InfoPath 2013 form trying to publish it to SharePoint 2013. When I click on publishing an error message appears stating "Creating the site content type failed". I can't figure out why this
is happening, any help on this one?
Also it appears the form template is uploaded when I go to the library settings under advance. When I see the .xsn file and click on it, it opens in InfoPath but not in sp.Rettajm, could you please find any errors in ULS?
-
SharePoint REST service to add an exsiting site content type to a list/library
Trying to use SharePoint 2013 REST Service to add existing site content types to a list/library. Below MSDN article suggests that the POST method is available but does not say how to use it.
http://msdn.microsoft.com/en-us/library/office/jj246793%28v=office.15%29.aspx#postsyntax_htm
POST http://<sitecollection>/<site>/_api/web/lists(listid)/contenttypes/add(parameters)
How do we create the body for this rest call?Hi You need to use the addAvailableContentType method to attach a Existing Content Type to a list/Library.
Consider the below Sample. Take the Id of the Content Type and pass it.
the REST API URL is
http://<sitecollection>/<site>/_api/web/lists(listid)/contenttypes/addAvailableContentType(contentTypeId)
var siteUrl = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('Employees')/ContentTypes/AddAvailableContentType";
var call = jQuery.ajax({
url: siteUrl,
type: "POST",
data: JSON.stringify({
"contentTypeId": "0x0100E5EC1FE6D284A74A972A1776FFFE2DA0"
headers:
'accept': 'application/json;odata=verbose',
"content-type": "application/json;odata=verbose",
"X-RequestDigest": jQuery("#__REQUESTDIGEST").val()
call.done(function (data, textStatus, jqXHR) {
var message = jQuery("#message");
message.text("Added Content Type Successfully");
call.fail(function (data, errorcode, errormessage) {
alert("Could not enable content types: " + errormessage);
Here 0x0100E5EC1FE6D284A74A972A1776FFFE2DA0 is the Content Type Id of my existing Content type "Employees"
Ensure the AllowContentTypes is set to True for that List/Library
R.Mani | http://rmanimaran.wordpress.com -
Copying content type across site collection
It is a good practice to create a content type and then create a list from it.
Now, say that we create a content type and then create a list from it.
If we want to create similar list in a different site collection, we need to have the content type in that site collection as well.
Could you please let me know how to copying the content type from one site collection to another.
ThanksHi,
Thanks for posting your query, Kindly try out the below mentioned script to copying your Content Type from one site to another
Add-PSSnapin Microsoft.SharePoint.PowerShell
$w1 = Get-SPWeb "https://sharepointsite1.com"
$w2 = Get-SPWeb "https://sharepointsite2.com"
foreach ($f1 in $w1.Fields) {
if ($f1.Group -eq "PepsiSiteColumns") {
$f2 = $w2.Fields | Where { $_.Id -eq $f1.Id };
if ($f2 -eq $null) {
Write-Host("Creating field " + $f1.Title + "...");
$f2 = $w2.Fields.AddFieldAsXml($f1.SchemaXml);
$f1.Delete(); # Careful with this one!
} else {
Write-Host("Field " + $f1.Title + " already exists. Not taking any action.");
Also, browse below mentioned URL to fix this issue
http://blog.falchionconsulting.com/index.php/2007/08/copy-content-types/
I hope this is helpful to you, mark it as Helpful.
If this works, Please mark it as Answered.
Regards,
Dharmendra Singh (MCPD-EA | MCTS)
Blog : http://sharepoint-community.net/profile/DharmendraSingh -
Add existing site content type to doc lib -power shell
Add-PSSnapIn Microsoft.SharePoint.PowerShell
#Update : incomplete on 09-feb-2015 05 pm
$siteCollecURL = "http://sirvr11:123/sites/Engineering/WIP"
$basicContentType="Basic Content Type"
#$siteColl = Get-SPSite -Identity $siteCollecURL
$paramWeb = Get-SPWeb -Identity $siteCollecURL
Write-Host $siteColl.Url
$pdoclib ="CY"
$docLib = $paramWeb.Lists[$pdoclib]
$docLib.Title
if ($docLib -ne $null)
$docLib.ContentTypesEnabled = $true
$docLib.Update()
#Add site content types to the list
$ctToAdd = $paramWeb.ContentTypes["Basic Content Type"]
$ctToAdd.Name
pause
try
$ct = $docLib.ContentTypes.Add($ctToAdd)
catch
write-host "error adding Content type" $ct.Name "to" $docLib.Title
write-host "Content type" $ct.Name "added to list" $docLib.Title
$docLib.Update()
am trying to add the "BasicContent Type" to my doc lib called "CY" with the help of above power shells cript.
but it failed to add .
getting the error message.can anyone pls help where am missing any steps /line of code.
help is appreciated!Hi,
try the following
#Get site object and specify name of the library to look for in each site
$site = Get-SPSite http://portal
$lookForList = "Shared Documents"
#Walk through each site and change content types on the list specified
$site | Get-SPWeb -Limit all | ForEach-Object {
write-host "Checking site:"$_.Title
#Make sure content types are allowed on the list specified
$docLibrary = $_.Lists[$lookForList]
if ($docLibrary -ne $null)
$docLibrary.ContentTypesEnabled = $true
$docLibrary.Update()
#Add site content types to the list
$ctToAdd = $site.RootWeb.ContentTypes["Sales Document"]
$ct = $docLibrary.ContentTypes.Add($ctToAdd)
write-host "Content type" $ct.Name "added to list" $docLibrary.Title
$ctToAdd = $site.RootWeb.ContentTypes["IT Document"]
$ct = $docLibrary.ContentTypes.Add($ctToAdd)
write-host "Content type" $ct.Name "added to list" $docLibrary.Title
$docLibrary.Update()
else
write-host "The list" $lookForList "does not exist in site" $_.Title
#Dispose of the site object
$site.Dispose()
Kind Regards,
John Naguib
Technical Consultant/Architect
MCITP, MCPD, MCTS, MCT, TOGAF 9 Foundation
Please remember to mark your question as answered if this solves your problem -
Upgrade Content Server and Site Studio
Hello Everyone,
We are trying to upgrade both Content Server and Site Studio from 7.1 / 7.2.1 to
10gR3
1) Instead of updating existing instance we Installed new 10gR3 instance
Exported folder structure archive, layout files and data files from old instance
2) Imported into new 10gR3 instance.
3) Tried to upgrade sitestudio websites
4) Its created a project file but not adding any SiteStudio section properties
(ex. primaryURL, secondaryURL, IncludeSectionInNavigation etc.), if I open the site in
designer, it shows just blank site structure without any templates associated and all sections are disabled.
Any ideas on this??
VenkatHi ,
If you are displaying the data from spaces only then all the operations like creating a web content , editing it etc can be done from Webcenter spaces itself .
Thanks
Srinath -
Using the External Content Type as a column lookup
Hi.
I am working on a solution that will get data from a web service (third party) and create a list in SharePoint Online (Office365 E3 subscription). The use a column from that list as a lookup column for another list. The reason for this is to allow updates
on the third party data source to update the list in Office 365.
Using SPD 2013, I created that external content type then created the list. However, due to the limitations on BCS (which I just learned after googling it) that the only thing I can use from this column is the ID column.
Has anyone found a work around on the matter? I was thinking of just creating a list app then load the bcs data to it. My problem will be how to update the list every so often.
Thanks!
Robert
Outsource TrainerHi,
According to your post, my understanding is that you want to use the External Content Type as a column lookup.
Per my knowleage, you can select all the columns in the external list.
You can create a lookup column in the list as below:
If you select Name, then you can get the Name column as below:
There is an article for your reference, although it is about the SharePoint 2010, it still works for SharePoint Online 2013.
Creating SharePoint lookups which get their data from a lookup
table in SQL (using SharePoint Designer, BCS and External Content Types)
More information:
Make an External List from a SQL Azure table
with Business Connectivity Services and Secure Store - SharePoint Online for enterprises
Thanks,
Linda Li
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]
Linda Li
TechNet Community Support -
When I change the settings to allow for the content type and page extraction and save it, it shows allowed. When I close the pdf, reopen it, review the security properties, it shows the content type as allowed and the page extraction as disallowed. I need both to stay at allowed, how do make this happen?
The moment that you select not to allow any kind of change done to the file then pages extraction is automatically not allowed as well. There's no way around that.
-
SRT: Wrong Content-Type and empty HTTP-Body received
Hi All,
I created and activated a web service for data acquisition in BI 7.0. The service has been activated and when do a test service from SICF transaction I get the following error page.
I appreciate any help to resolve this issue.
Thanks,
Jomon
- <soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header />
- <soap-env:Body>
- <soap-env:Fault>
<faultcode>soap-env:Server</faultcode>
<faultstring xml:lang="en">SRT: Wrong Content-Type and empty HTTP-Body received</faultstring>
- <detail>
- <ns:SystemFault xmlns:ns="http://www.sap.com/webas/710/soap/runtime/abap/fault/system/">
<Host>undefined</Host>
<Component>COREMSG</Component>
- <ChainedException>
<Exception_Name>CX_SOAP_CORE</Exception_Name>
<Exception_Text>SRT: Wrong Content-Type and empty HTTP-Body received</Exception_Text>
</ChainedException>
</ns:SystemFault>
</detail>
</soap-env:Fault>
</soap-env:Body>
</soap-env:Envelope>good morning,
i am having the same problem, did you find an answer for this? can you update either this message, or reply back at your findings.
we are trying to get a external system to talk with ecc 6.0 thru sap connecter for .net v2.0.1. it worked with sap 4.6c, but not now.
any help is appreciated.
thanks. -
List with Multiple Content Types and Making new Forms...
I go to create custom forms based on content types. After I create using the wizard in the list it always shows the same form no matter which content type I pick.
what am I doing wrong?
David JenkinsYou can change the custom form on content type through SharePoint Designer. Do not change it on the content type directly, when you add content type in a list/library, then open list's content types in SP Designer and then select your content type and modify
the URLs of your custom display form.
I have updated a document in gallery for
step by step development of custom workflow and custom task form. In this document you can find the association of custom form with content type using SP Designer.
Adnan Amin MCT, SharePoint Architect | If you find this post useful kindly please mark it as an answer :) -
Hi Team,
I need to access Java web service which is simple service and accepts and returns XML over HTTP. No credentials are needed to access the service. We need to pass following two HTTP headers (Content-Type and Authorization) along with XML request message:
<GetStatus> message is being constructed in the orchestration and URI is constant to access.
Which adapter shall I use to get the response back? I tried using WCF-WSHttp with Security Mode = Transport, and different options of client credential types but every time, error returned stating:
System.Net.WebException:
The HTTP request is unauthorized with client authentication scheme 'Basic'. The
authentication header received from the server was 'Basic realm='.
Authentication failed for principal Basic. Message payload is of type:
String
In Fiddler, request looks line following
POST <https://URL/GetServiceReopnse HTTP/1.1
Content-Type: application/xml
Authorization: Basic cmVmU3RhdHN2Y19kgeRfsdfs=
Host: <Server name>
<GetStatus XMLNS="http://server.com/.....">
<OrgId>232323</OrgId>
<HubId>3232342323</HubId>
</GetStatus>
MMK-007First, you should not use the HTTP Adapter because it's been deprecated and replaced by WCF.
Start with the WCF-Custom Adapter and select the customBinding.
You should start with the textMessageEncoder and httpTransport and go from there. -
Content types, Required site columns, How are they supposed to work?
Hi,
I have 2 issues:
I created a Folder level content type with many Required site columns. I was hoping that when I create a new folder the new content type screen will pop up and I must enter all the required properties (metadata) for this new folder.
Issue 1) But it didn't work that way. It just required me to enter the name of the folder and the folder was created.
Issue 2) I then went to Edit Properties to enter enter all the required metadata. I would like to have my newly created content type to be the default. So that when I open up the Edit Properties the popup screen would defalt to my new
content type. But it defaults to "Folder" Content type. even though in liberary setting, My new content type was the only one check "visible" and set as default.
Can someone please help? Am I missing something?
Thanks!I don't think you can do what you want to do using only out of the box features. A few notes:
Users will need to click the New Document dropdown in the ribbon to select your new folder content type. (I.e. Don't click New Folder)
The "default" option in the content type list is to pick the default content type to be selected when you click the New Document button. (I.e. it won't impact the New Folder ribbon button)
The ribbon button for New Folder is hard coded to use the built in folder feature.
You may want to look into the 2010 Document Set feature to create folders with metadata. It will do what your custom content type does and a lot more.
Possible solutions:
Create JavaScript hack that changes the New Folder link in the ribbon to go to the New Document link for your custom content type.
Create a Visual Studio Feature to hide the New Folder button and add a new New Folder button that points to the New Document link for your custom content type.
Leave the existing New Folder button there and create Feature to add a new custom button for your content type.
Mike Smith TechTrainingNotes.blogspot.com
my SP customization book
Maybe you are looking for
-
I can hear sounds when I plug in to headphones or on bluetooth (streaming audio from my car). Can anyone help? I have the iphone 4s. Thank you!
-
Maximum size of a compiled JSP page
Has anybody else come accross a problem with weblogic not displaying .jsp pages greater than
-
Howto quote percent (%) in formsweb.cfg/HTMLbeforeForm
Hello, I would like to embed an iframe in basejini.htm/basejpi.htm. Doing this by setting HTMLbeforeForm=<iframe src="frame.html" name="frame" width="100%"></iframe> works almost perfectly, but "width=100%" doesn't work, since any occurrences of "%"
-
[ ? ] Targetting function inside imported SWF
Hi, Is it possible to target function that's inside imported (or Loaded) swf file? I want to load external swf file into my fla project file, and then with a press of a button (for example) trigger a function that's inside that imported (or Loaded) s
-
Where are attachments stored on a PC?
On my Mac, when I get an email with a image embedded in the email, I can go my Home > Library > Mail Downloads folder and get it there. Do my friends on a PC have some similar folder? I often get complaints "I can't save your jpg because it is embedd