REST Query to Get Content Type Name
I'm just getting started learning to use the SharePoint REST interface. One of the first things I'd like to do is return the content type name for a list item in a document library (the document library is configured with several content types). From
what I've read, it looks like I need to use the $expand query option. So, my REST query looks like this:
http://localhost/_api/web/lists/Documents/Items()?&$select=ContentType/Name&$expand=ContentType/Name
But it's not working. I can't "dig" out the content type name property. In other words the $expand query option is not working. I just receive the following which includes a link to the content type:
<entry m:etag=""2"">
<id>4078e129-ac4b-44b8-b469-bcc083f2268d</id>
<category term="SP.Data.DocumentsItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link rel="edit" href="Web/Lists(guid'cd710fd1-057e-4ee7-b0bd-1f014218ea3e')/Items(36)" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ContentType" type="application/atom+xml;type=entry" title="ContentType" href="Web/Lists(guid'cd710fd1-057e-4ee7-b0bd-1f014218ea3e')/Items(36)/ContentType"
/>
<title />
<updated>2013-04-12T00:16:26Z</updated>
<author>
<name />
</author>
<content type="application/xml" />
</entry>
I've tried difference variations and if I just use "$expand=ContentType" then I get all the list items with the content type fully expanded within each item.
What am I missing?
It's been awhile since this question got asked, but I figured i'd post for anyone who happens to stumble
on it.
Try this:
http://localhost/_api/web/lists/Documents/Items(<item
id>)/ContentType?$select=Name
Similar Messages
-
Hi,
I am trying to create "View" in a Document Library and need to enable following:
1. Mark as default View
2. Folders -> Show this view : in Folders of Content Type : {Custom Content Type name}
I am using following code which sets "in Folders of Content Type : " to "Folder" rather than selecting custom content type despite passing Content Type ID of custom content type.
code:
var itemContentTypes = clientContext.LoadQuery(web.AvailableContentTypes.Where(ct => ct.Name == viewContentType));
clientContext.ExecuteQuery();
var itemContentType = itemContentTypes.FirstOrDefault();
view.ContentTypeId = itemContentType.Id;
view.DefaultViewForContentType = true;
view.Update();
clientContext.ExecuteQuery();
Please highlight what seems to be missing?
Thanks
SonalHi,
Before you set the content type ID for the view, you need to add the custom content type to the library firstly.
You can add the content type to library using OOTB feature “Add from existing site content types” in library settings or using Client Object Model.
Here is a code snippet for your reference:
var list = context.Web.Lists.GetByTitle(listTitle);
list.ContentTypesEnabled = true;
var contentType = context.Site.RootWeb.ContentTypes.GetById("0x0120");
list.ContentTypes.AddExistingContentType(contentType);
context.ExecuteQuery();
More information about add exist content type using Client Object Model:<o:p></o:p>
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.contenttypecollection.addexistingcontenttype%28v=office.15%29.aspx
Best regards,
ZhengyuGuo
Zhengyu Guo
TechNet Community Support -
Content Type name is not changing on site level
Hello
I have one new SP2010 site. I am changing the content type name using following script, but it is not working. I have not used content type in any list or library nor in any existing ite, I am not using content type hub. Can anyone why content name is not
updating?
$ParentContentType = $site.RootWeb.AvailableContentTypes["Data control1"]
if ($ParentContentType -eq $null)
write-host "not exist"
else
$web.$ParentContentType.Name="Data 123Control1"
$web.AllowUnsafeUpdates = $true;
$web.Update()
$web.AllowUnsafeUpdates = $false;Make the following change, hope this helps you
$site.RootWeb.AvailableContentTypes
to
$site.RootWeb.ContentTypes
Ashish Kanoongo, MCP, MCSD, MCTS http://akanoongo.blogspot.in/ -
How do i edit content type name or remove in applications panel
how do i edit content type name or remove the name in applications panel.In the App panel the name is Winrar zip Archive. when i try to download rar file is all way ask me what to do.when i download zip file is save the files.I would like to add rar to the Applications panel
The MIME Edit extension for Firefox 3.0 - 3.7 versions is available here:
http://space.geocities.yahoo.co.jp/gl/alice0775/view/20080912/1221150790
The developer who updated that extension is from Japan, and that website won't be completely readable if you don't have the correct language package installed.
You can download it directly from this link and save it to local disk.
http://space.geocities.jp/alice0775/STORE/mime_edit-0.601004242000.xpi
Then use File > Open File... to install that extension. -
SQL Query to get Project Plan Name and Resource Name from Reporting database of Project Server 2007
Can you please help me to write an SQL Query to get Project Plan Name and Resource Name from Reporting database of Project Server 2007. Thanks!!
Refer
http://gallery.technet.microsoft.com/projectserver/Server-20072010-SQL-Get-a99d4bc6
SELECT
dbo.MSP_EpmAssignment_UserView.ProjectUID,
dbo.MSP_EpmAssignment_UserView.TaskUID,
dbo.MSP_EpmProject_UserView.ProjectName,
dbo.MSP_EpmTask_UserView.TaskName,
dbo.MSP_EpmAssignment_UserView.ResourceUID,
dbo.MSP_EpmResource_UserView.ResourceName,
dbo.MSP_EpmResource_UserView.ResourceInitials
INTO #TempTable
FROM dbo.MSP_EpmAssignment_UserView INNER JOIN
dbo.MSP_EpmProject_UserView ON dbo.MSP_EpmAssignment_UserView.ProjectUID = dbo.MSP_EpmProject_UserView.ProjectUID INNER JOIN
dbo.MSP_EpmTask_UserView ON dbo.MSP_EpmAssignment_UserView.TaskUID = dbo.MSP_EpmTask_UserView.TaskUID INNER JOIN
dbo.MSP_EpmResource_UserView ON dbo.MSP_EpmAssignment_UserView.ResourceUID = dbo.MSP_EpmResource_UserView.ResourceUID
SELECT
ProjectUID,
TaskUID,
ProjectName,
TaskName,
STUFF((
SELECT ', ' + ResourceInitials
FROM #TempTable
WHERE (TaskUID = Results.TaskUID)
FOR XML PATH (''))
,1,2,'') AS ResourceInitialsCombined,
STUFF((
SELECT ', ' + ResourceName
FROM #TempTable
WHERE (TaskUID = Results.TaskUID)
FOR XML PATH (''))
,1,2,'') AS ResourceNameCombined
FROM #TempTable Results
GROUP BY TaskUID,ProjectUID,ProjectName,TaskName
DROP TABLE #TempTable
-Prashanth -
Query to get batch GLBATCH name for the invoices of AP and AR
Please provide a query to get GLBatch name for an invoice of AR and AR.
From one cursor iam getting invoice number and invoiceID of AP and AR.
I have written query but it is taking much time
select distinct gjb.NAME
from gl_je_headers gjh,
gl_je_lines gjl,
gl_je_batches gjb
where gjl.REFERENCE_2=to_char(:p_invoiceid)
and gjh.JE_HEADER_ID=gjl.JE_HEADER_ID
and gjh.JE_BATCH_ID=gjb.JE_BATCH_ID
so iam getting performance problem.
Please suggest if iam wrong.
Waiting for your valuable suggestion.
Thanks
ganeshHi,
the version of Oracle E-Business Suite is R12
and ORacle Database IS 11I
Thanks & Regards
ganesh -
Hi all,
I am doing a final year student project in constructing a visual tracing tool in java. I have a problem getting the method arguments and method argument types similar to problem posted before http://forum.java.sun.com/thread.jsp?forum=47&thread=200408
basically every time i track the method entry event and ask for the list of argument types i get the outmof bounds exception as if there is nothing in the method arguments. But i forced values into the arguments.They are there. I cannot understand this. I trawled through the examples and trace example with the java documentation and followed their example but still no luck. The program i'm tracing is simple on below
public class testProgram{
private String name;
private int age;
public testProgram(){
setage(22);
setName("ciaran");
public void setage(int theAge){
age = theAge;
public void setName(String theName){
name = theName;
public static void main(String[] args ){
testProgram aTest = new testProgram();
the tracking code is below
public ParseMethodData(MethodEntryEvent event){
locEvent = (LocatableEvent) event;
Location loc = locEvent.location();
Method meth = loc.method();
threadRef = locEvent.thread();
refType = loc.declaringType();
try{
ArrayList list =(ArrayList) meth.argumentTypeNames();
}catch(IndexOutOfBoundsException iobe){
iobe.printStackTrace();
Any "general" ideas would be welcome. Why are the arguments not coming out.Hia there,
I've been looking at the jdb source code for ages now, and have had the same problems with you here. What I found was that you need to wait until a vmInterupptedEvent has been generated, otherwise you cannot access the information safely - the jvm may not have been suspended at the time that the methodentryevent was generated. This really is the case because I tested the EventHandler code in the JDB (or tty) source code. So, if you're interested in information like argument names, values and types from a methodevent, then get a list of argument type names from the method event, and when the virtual machine is suspended (i.e. a vmInterrupted event has been generated) you can safely map these to their values in the corresponding stackframe that execution is in.
There are about ten million other problems I have found with using the JDB, and stuff like that but I hope this helps. What I said worked for me, but murphy's law (most prevalent with the JDI) suggests it won't for you.
PS. So what you need to do is, implement vmInterrupted, and ensure requests are set to true for these, then use access data once this has been called.
Byee - Edd. -
Hello Friends,
I have 4 list based content types which have a similar column "appendix" as single line of text. I have added them to my list. My requirement is, when I click on the new item and select the content type, I should get the content type info in the appendix
column.
Can someone help me on getting that info? I cannot use the InfoPath forms to get the information.
Please suggestHi ChandraShekhar
You need to first go through the below links in-order to resolve you problem
Content Types
Indul Hassan
Microsoft Community Contributor
http://www.indulhassan.com
You Snooze.. You Lose !! -
Is it possible to get object type name with help of key field?
can any one tell me is it really possible to get the object type name if i have only key field,
are there any tables which store the object type names & keyfield. or there are any functionmodue which gives object type name by entering keyfield.Hello,
If the PO has workflows associated with it, there is a table SWIWIOBJCT which stores details of the workitem, object key , object type details.
If you input the object key to this table ( For ex: PO number in this case) , it will give you the corresponding object type for the object key for Workitem type F.
Thanks,
Sowmya Arni -
Abstract way to get Content Type of a File?
Using a java.io.File or java.io.FileInputStream is there any was the get the mime type of that file? I am working with a JEditorPane which loads files from a JTree, however I would like to take advantage of the tree's setContentType method for formatting...
I think the
JAVABEANS ACTIVATION FRAMEWORK (JAF)
is what you're looking for.
http://java.sun.com/products/javabeans/glasgow/jaf.html
But I actually never used it... (or not yet :-) )
Greets
Puce -
SQL query to get the responsibility name
Hi,
I require an SQL query which would give the responsibilty name to which the concurrent programs are assigned.
Thanks& Regards,SELECT fcpv.user_concurrent_program_name
FROM fnd_request_groups frg,
fnd_request_group_units frgu,
fnd_concurrent_programs_vl fcpv,
fnd_responsibility_vl frv
WHERE frgu.request_group_id = frg.request_group_id
AND frgu.request_unit_id = fcpv.concurrent_program_id
AND frv.request_group_id = frg.request_group_id
AND frgu.request_unit_type = 'P'
AND frv.responsibility_name =<Responsibility Name>Regards
Prashant Pathak -
Regarding FMS query to get the account name and get it in the report
Dear all,
I have created a FMS query to pick the G/L account name in the payment voucher,But the name which i got through the FMS in an UDF is not coming properly.It comes only if am manually entering Shift+F2 in that field.
Pls give me a suggestion for that.
The FMS query is.
SELECT T1.[AcctName] FROM VPM1 T0 INNER JOIN OACT T1 ON T0.CheckAct = T1.AcctCode INNER JOIN OVPM T2 ON T0.DocNum = T2.DocEntry WHERE T2.[DocNum] = $[ovpm.docnum]hi,
try this:
SELECT T0.AcctName FROM OACT T0 WHERE T0.AcctCode=$[VPM1.CheckAct]
Thanks,
Neetu -
Hi There,
I want to append the SERVICE name to my email subject sent using UTL_SMTP. I am running it within PL/SQL so that it can change based on the instance. I can do a V$instance, but that shows the sid and not the service name.
Thankssys_context is the function which gives you such info:
SELECT sys_context('USERENV', 'SERVICE_NAME') FROM DUAL;Cheers,
Manik. -
Images are not downloaded at all and page looks broken.
The same page works fine over HTTP but shows the problem over HTTPS. Works fine in firefox and chrome.
Checked and found the problem in IE 9, 10, 11
Is it some bug in IE, I have searched the forums and searched internet. Got following but are not relevant to this case.
Resetting src of the img (Ruled out, not doing any reset)
Do not save encrypted pages to disk is checked in advanced security options (Ruled out, unchecked)
Using TLS 1.2 with SSL 2.0 (Ruled out, SSL 2.0 unchecked)
Cache-preventing headers: Cache-Control header with the tokens no-cache, no-store (Ruled out, no such headers)
Restarts due to parser reset owing XML Namespace declaration, Meta tags etc. (Ruled out, image tags are afterwards)
Thanks in advance for help!I probably encountered the same problem.
What happens when you disable the 'Use TLS 1.0' checkbox in Internet Options, Advanced, Security, 'Use TLS 1.0'?
The only enabled option I have in IE is 'Use SSL 3.0'.
Source:
http://social.msdn.microsoft.com/Forums/ie/en-US/88a58e78-ebb4-469d-a361-0d3762a4cf80/ie10-reports-aborted-js-and-css-downloads-randomly?forum=iewebdevelopment -
Content Types updates not getting pushed to Lists/Libraries Sharepoint 2013
Hello,
We have updated Content Type at Content Type Hub(ex. Making columns Hidden/Req...etc..). These changes are pushed to the consumer sites site level Content types but the problem is these changes are not reflecting at List/Library level Content type.
Is there a way to explicitly push down the changes ?
Best Regards, Pankaj Ranahttp://sharepoint.stackexchange.com/questions/52259/how-to-update-a-deployed-content-type
perform the changes to the ContentType make sure to push changes to the lists while updating the ContentType.
For now, you might need to perform some clean-up job here, just to make sure the field is deleted from all the lists, with your Custom ContentType. Use the following PowerShell script for clean-up! Vårsegod :)
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
$site = Get-SPSite "http://your.site.com"
foreach($web in $site.AllWebs)
#iterates through all the Lists
for ($i = 0; $i -lt $web.Lists.Count; $i++)
$list = $web.Lists[$i];
$MyListContentTypes = $list.ContentTypes
if ($MyListContentTypes -ne $null)
$ct = $list.ContentTypes["You Desired Content Type Name"]
if($ct)
Write-Host "In list Content Type and deleting the field" $ct.Fields["You Field Name"].Id;
$ct.FieldLinks.Delete($ct.Fields["You Field Name"].Id)
$ct.Update()
Edit: How to push down changes to all the Content types via SharePoint Server Object Model:
using (SPWeb oWebsite = new SPSite("http://MyServer/sites/MySiteCollection/MyWebSite").OpenWeb())
SPList oList = oWebsite.GetList("MyWebSite/Lists/MyList");
SPFieldCollection collFields = oWebsite.Fields;
string strNewColumn = collFields.Add("MyNewColumn", SPFieldType.Text, false);
SPFieldLink oFieldLink = new SPFieldLink(fields[strNewColumn]);
SPContentType oContentType = oList.ContentTypes["Specification"];
oContentType.FieldLinks.Add(oFieldLink);
oContentType.Update(true);
Edit 2: Update a Content Type using PowerShell:
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
//get the specific Root web
$spweb= Get-SPWeb "http://your.site.com"
//get the fields collection
$fields = $spWeb.Fields
//get the specific field
$field = $fields.GetFieldByInternalName("Name of you field")
//get the specific Content Types from Root Web
$contentType = $spWeb.ContentTypes["You Content Type"]
//delete a field from a Content Type
$contentType.FieldLinks.Delete($field)
//add a field to a Content Type
$contentType.FieldLinks.Add($field)
//update the Content Type and push changes to the children
$contentType.Update($true)http://sharepoint.stackexchange.com/questions/42744/how-to-add-a-field-to-a-contenttype-with-feature-upgrade-for-new-and-existing-shttp://msdn.microsoft.com/en-us/library/office/aa543504%28v=office.14%29.aspx
If this helped you resolve your issue, please mark it Answered
Maybe you are looking for
-
How to save as in a non browseble network drive
Hello, is there a way i can perform a save as to a non browseble drive but it's mounted and I can see it on the desktop? Thanks, Butch
-
ORA-00904: invalid identifier
have a problem with this select statement: select NLS_CHARACTERSET, NLS_NCHAR_CHARACTERSET, NLS_TERRITORY, NLS_LANGUAGE, NLS_SORT from nls_database_parameters ORDER BY PARAMETER ERROR at line 1: ORA-00942: table or view does not exist but if I do thi
-
Host server live migration causing Guest Cluster node goes down
Hi I have two node Hyper host cluster , Im using converged network for Host management,Live migartion and cluster network. And Separate NICs for ISCSI multi-pathing. When I live migrate the Guest node from one host to another , within guest cluster
-
Hi I Have A Prepaid Smart Phone Right Now With Verizon For About 7-Months So Far. I Have Always Paid On Time No Missed Payments Good Standing Account, I Tried To Switch Over To A 2-Year Contract With Verizon And They Wanted A $400 Deposit For Only 1-
-
Hi, my question is about firmware. I have a 233mhz that is giving me fits. Firmware version 3.0.f3 build date 12-2-98. I have 128MB ram and os x installed (10.3.9). I can't seem to boot into os x. It goes to a failed to boot screen that gives me the