How to retrieve the content type used in a document library (C# - Client Model).

Hello,
I need to know if it's possible to retrieve the content type used in a document library, so I can know the columns active and used in this document library. I am using the Client Model in C#.
Thanks

First, retrieve your document library as a List object. Then, use the
List.ContentTypes property to iterate through all the content types assigned to the list.
Blog:
blog.beckybertram.com |
RSS | @beckybertram |
SharePoint 2010: Six-in-One

Similar Messages

  • How do retrieve the contents from a DataTable?

    I have a DataTable filled with the contents of an Excel spreadsheet. 
        DataTable dtDataTable = new DataTable();
        using (OleDbDataAdapter oledbAdapter = new OleDbDataAdapter(oledbCmd))
            oledbAdapter.Fill(dtDataTable);
    How do retrieve the contents from the DataTable? ... one value at a time (for example row 3, column 5).
    bhs67

    This works:           
        string stData = dtDataTable.Rows[3].ItemArray[5].ToString();
    bhs67

  • How to retrieve the content of the indexed column

    In Oracle UltraSearch, how to retrieve the content of the file in the indexed column cache_file_path.
    we try the flowing sql
    SELECT cache_file_path FROM mytable
    WHERE contains (mytable.cache_file_path, 'viet', 1) > 0
    but we only have the cache_file_path column, not the content of the file were indexed.

    I think this is what you're looking for:
    DECLARE @table TABLE (amountPaid FLOAT, datePaid DATE, memberID INT)
    INSERT INTO @table (amountPaid, datePaid, memberID) VALUES
    (10.00, '2014-01-01',1),(10.00, '2014-02-01',2),(10.00, '2014-03-01',3),(10.00, '2014-04-01',4),(10.00, '2014-05-01',5),(10.00, '2014-06-01',6),(10.00, '2014-07-01',7),(10.00, '2014-08-01',8),(10.00, '2014-01-01',9),(10.00, '2014-10-01',10)
    SELECT *
    FROM (
    SELECT *, SUM(amountPaid) OVER (ORDER BY datePaid ROWS UNBOUNDED PRECEDING) AS runningTotal, ((SELECT SUM(amountPaid) FROM @table) / 100) * 50 AS percentileAmount
    FROM @table
    ) x
    WHERE percentileAmount >= runningTotal
    It depends upon SQL Server 2012's windowed functions. It would be possible to also do this with a rCTE in earlier versions.
    Giving your code an eyball, I think I see what it's doing. Unfortunately, I'm stuck using 2008 R2, so I don't have access to UNBOUNDED or PRECEDING. I'll have to research rCTE - I know what a CTE is, but not the 'r' prefix.

  • Programmatically: Support content types in the gallery and for content types associated with a document library

    Hi there,
    Help appreciated in programmatically 'Supporting content types in the gallery and for content types associated with a document library'.
    Any resources/references or source is greatly appreciated.
    Regards,

    Hi,
    Would you mind providing more details about your requirement? Cause I'm not quite clear about what you really need.
    What’s more, there are seems two questions in your post. If you have several questions to ask, I suggest you post them into every single thread to make them easier to be discussed
    in the forum.
    Best regards
    Patrick Liang
    TechNet Community Support

  • How to chek the content type thru java script !!

    Hii Guys ,one more prb,
    I need to develop a file uploading utility in struts to upload ZIP files(only ZIP), and i sucseeded to do it using the commons.fileupload which comes along with the WSAD5.1(examples), but the prb is i need to chek for the MIME type and need to reject if its not a zip file, if i do this in actionclass, its waiting till the uploading process of the file is finished and finally its displaying file is not the a ZIP, i need to do this validation as the request comes to the server side, i cant not do this in clint side cause my design should not allow me to use any java script..so please let me know is there any way to specify in the controller it self .
    if i use java script, how can i do the Content type validation ?
    thanx in advance

    so definetly u mean , we need to wait till the
    filegot uploaded to server, if we use server side
    validation?Well, for server side validation, yes you have to wait for the file to upload.
    I've always kinda disliked that, since it could be a big file and/or slow connection. But short of possibly using JS to check the filename (and I don't remember if you actually can, and it's not accurate in many case), there's nothing else you can do.

  • How to retrieve the data type of a column of a table?

    Hi,
    I want to retrieve the data type of a column of a table. At the moment I am querying "OCI_ATTR_DATA_TYPE" attribute but it is returning SQLT_CHR for both varchar2 and nvarchar2 data type columns. I need to distinguish between these two data types columns separately. Is there any API through which I could get the exact data type of a column i.e. "nvarchar2"?
    Thanks in advance.
    Hashim

    Hi,
    This is the Oracle C++ Call Interface (OCCI) forum - I'm not sure if you are using OCCI or OCI (Oracle Call Interface - the C interface) since you reference "OCI_ATTR_DATA_TYPE" which is more of an OCI focus than OCCI.
    In any case, you might take a look at "OCI_ATTR_CHARSET_FORM" which takes the following values:
    #define SQLCS_IMPLICIT 1     /* for CHAR, VARCHAR2, CLOB w/o a specified set */
    #define SQLCS_NCHAR    2                  /* for NCHAR, NCHAR VARYING, NCLOB */So, if you have a datatype of SQLT_CHR and OCI_ATTR_CHARSET_FORM is SQLCS_IMPLICIT then you have a varchar2 if it is SQLCS_NCHAR then you have an nvarchar2.
    If you are using OCCI and not OCI then take a look at MetaData::ATTR_DATA_TYPE and MetaData::ATTR_CHARSET_FORM which expose OCI_ATTR_DATA_TYPE and OCI_ATTR_CHARSET_FORM respectively.
    Perhaps that will get you what you want.
    Regards,
    Mark

  • How to extract the mime type using HttpExchange?

    Hi,
    I am using Sun httpserver to implement an HTTP Server. I am implementing the class HttpHandler and so implementing the method,
    public void handle(HttpExchange t) throws IOException
    }I just need to know, in the above method, is there a proper way to know the Content-type to know the mime type? Or I would have to traverse through all the headers?
    Regards,
    Kashif

    [HttpExchange.getRequestHeaders()|http://java.sun.com/javase/6/docs/jre/api/net/httpserver/spec/com/sun/net/httpserver/HttpExchange.html#getRequestHeaders%28%29] returns a Map...

  • How to retrieving the content using Links

    Hi
    Please suggest me how to retrive content using link property.
    I have added link property to my Content. and i have added in internal resource path to the Link property.
    But my question is how access the page which is linked to my Content.
    How can i use it with anchor tag when i want show display the linked page content.
    what are tags to be used to retrive the linked content in the page.
    I found below line in CM documentation
    "These relationships are used by developers in their content queries when retrieving content to display in
    your portal."
    But i could found how to retrive.
    Genarally what technique we use to link an internal resource of our Content management
    thanks in advance
    Edited by: vamshi krishna on Jun 12, 2011 12:32 AM

    It sounds like there may be a misunderstanding about our link property feature.
    That feature is not for web hyperlinks. For that you can just use a string property. The links feature is for pointers to other pieces of content.
    (from: http://download.oracle.com/docs/cd/E13155_01/wlp/docs103/cm/contentTypesCm.html)
    "Using Link Properties
    You can create properties that allow content contributors to associate content items. Content contributors can link to content within the same or different repositories within the Virtual Content Repository. For example, if you have related content items that are stored in different folders, you can use content link properties to create relationships among content items. These relationships are used by developers in their content queries when retrieving content to display in your portal.
    Link properties can also be multi-valued to allow content contributors to link to multiple content items. For detailed instructions on adding a link property, see Define the Properties of a Content Type."
    Edited by: Chris Bales on Jun 13, 2011 2:56 PM

  • How to retrieve the Id I used to create the Icloud environment. Each time I use an Apple identifier, I receive a message like it not the one you used at Icloud creation time

    Hi,
    I defined my Icloud environment some time ago. Unfortunatly, I forgot wich Id I used for it. Now I receive a message like "This is a valid Apple Id, but it is not the Id you used to create your Icloud environment.
    So, my question is: where and how can I either replace my Icloud Id or retrieve it ?
    Thank you for your help ...
    Regards
    By the way, you will probably consider that my English is as bad as a computer translation from French. I would thank you for this evaluation !

    Hi Michael,
    Follow the instructions on this link. Be sure to sign out of your old iCloud account on your computer and your devices before setting up you new one. Then sign on the new iCloud account on your PC and your devices once you have set it up using your new AppleID as the iCloud account:
    http://www.apple.com/icloud/setup/pc.html
    Cheers,
    GB

  • How to retrieve the users that are following a document using JSOM / REST APIs in SharePoint 2013

    Hi everyone,
    Does anyone know how to use JSOM / REST APIs to retrieve the users that are following a specific document in SharePoint 2013? 
    Thanks in advance,
    Nam

    Hi Nam,
    Please use the sample code to get the followers for the document. Courtesy: Mokhtar
    Bepari 
    using Microsoft.SharePoint.Client;
    using Microsoft.SharePoint.Client.Social;
    ClientContext clientContext = new ClientContext("http://URL");
    SocialFollowingManager followingManager = new SocialFollowingManager(clientContext);
    SocialActorInfo actorInfo = new SocialActorInfo();
    actorInfo.ContentUri = "<documenturl>"; //set the document url.
    actorInfo.ActorType = SocialActorType.Document;
    //By using the GetFollowed method you can get the people who the current user is following.
    ClientResult < SocialActor[] > followedResult = followingManager.GetFollowed(SocialActorTypes.Users);
    //By using the GetFollowers() method you can get the people who are following the current user.
    ClientResult < SocialActor[] > followersResult = followingManager.GetFollowers();
    clientContext.ExecuteQuery();
    Once you get the resultset you can iterate like below:
    foreach(SocialActor actor in followedResult)
    string name = actor.Name;
    string imageURL = actor.ImageUri;
    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

  • How to retrieve the action type of a PA40 action?

    Hi there,
    I am trying to find out the way to identify what was the action type for the personnel action that is just being executed. I will try to explain myself with a concrete example.
    Let's take the hiring action.
    A user goes to PA40 and initiates the action to hire a new employee. The program will then start guiding the user through the different infotypes defined within the infogroup.
    Let's say that the order is IT0001, IT0002, IT0006, ...
    I have setup table T779X to call a Function Module of my own after inserting IT0006. At that point in time I can know that the IT has been modified through transaction PA40 (sy-tcode) but, how can I know what action is being executed?
    Thanks

    Jim,
    Actions can always be found afterwards in IT000 indeed
    My problem is that I need to know what action type was initiated in REAL TIME. When I am debugging the batch for IT0006, after the user initiated an action through PA40
    Thanks for the answer anyway

  • How to know the Control type using event param???

    Hi,
    I wrote a function on MOUSE OVER EVENT. I called this
    function from a LIST and DATAGRID using addEventListener.
    Now i got a requirement like on event fire.. i wanna alert
    the control type i.e., whether the action fire from LIST or
    DATAGRID. I can create two different function for both LIST and
    DATAGRID. But requirement is like cannot reapeat the code.. code
    minimization.
    Is there any property to know the type of control(Like its
    LIST or DATAGRID) using event parameter??
    Thanks & Regards
    PRatap

    You can try using flash.utils.describeType or
    flash.utils.getQualifiedClassName on event.target property and
    figure out the control type.

  • How to retrieve the current User using PL_/SQL code?

    Hi,
    How can find the current logged user within a Dynamic Page using PL/SQL code?
    Thanks.

    Hi,
    There is a function wwctx_api.get_user which returns the logged in user. You can use this in your plsql code.
    Thanks,
    Sharmila

  • How to Retrieve the Selected Values from selectOrderShuttle using ADF 11g

    Hi Every One,
    Does anyone has idea how to retrieve the selected Items using shuttle and Order of the items using 'SelectOrderShuttle' component ?
    Thanks

    shuttle's valuechangeevent would fire when you shuttle items back and forth.
        public void selectOrderShuttle1_valueChangeListener(ValueChangeEvent valueChangeEvent) {
            ArrayList list = new ArrayList(Arrays.asList(valueChangeEvent.getNewValue()));
            if (list != null){
                for (int i=0; i<list.size(); i++) {
                    int l = list.size()-1;
                    val = list.get(l).toString(); //returns , delimited string
                    if (val != null){
                        val = val.replaceAll("[\\[\\]]", "");
                        StringTokenizer st = new StringTokenizer (val, ",");
                        int nto = st.countTokens ();
                        for (int j = 0; j < nto; j++)
                            String token = st.nextToken ();                     
                ..........

  • Deploying a Reusable Workflow to a List Content Type using PowerShell

    We have a situation where deployment of a reusable workflow for a site content type cannot be completed through the web interface due to the number of libraries where the content type is in use (time-out on deploy and update).
    It was hoped that this could be accomplished with PowerShell but the method of deploying to a list content type appears to be different than it is to a list (all content types).
    The below snippet works fine for a list / all content types:
    function AddWorkflowToLibraries ($SiteCollection, $ctName, $WfName, $WfAssociationName)
    $site = Get-SPSite $SiteCollection
    [Guid]$wfTemplateId = New-Object Guid
    #Step through each web in site collection
    $site | Get-SPWeb -limit all | ForEach-Object {
    $web = $_
    $_.Lists | ForEach-Object{
    if($_.AllowContentTypes -eq $true)
    if($_.ContentTypes.Item("$ctName") -ne $null)
    write-host "Enabling workflow on" $_.Title "in" $_.ParentWebUrl
    $ct = $_.ContentTypes[$ctName]
    $culture = New-Object System.Globalization.CultureInfo("en-US")
    $template = $site.RootWeb.WorkflowTemplates.GetTemplateByName($WfName, $culture)
    if($template -ne $null)
    $tasklist = "Tasks"
    $historylist = "Workflow History"
    if(!$web.Lists[$historylist])
    $web.Lists.Add($historylist, "A system library used to store workflow history information that is created in this site. It is created by the Publishing feature.",
    "WorkflowHistory", "00BFEA71-4EA5-48D4-A4AD-305CF7030140", 140, "100")
    if (!$web.Features["00BFEA71-4EA5-48D4-A4AD-305CF7030140"]) {
    Enable-SPFeature -Identity WorkflowHistoryList -Url $web.Url
    $wfHistory = $web.Lists[$historylist]
    $wfHistory.Hidden = $true
    $wfHistory.Update()
    if(!$web.Lists[$tasklist])
    $web.Lists.Add($tasklist, "This system library was created by the Publishing feature to store workflow tasks that are created in this site.", "WorkflowTasks", "00BFEA71-A83E-497E-9BA0-7A5C597D0107", 107, "100")
    $association = [Microsoft.SharePoint.Workflow.SPWorkflowAssociation]::CreateListAssociation($template, $wfName, $web.Lists[$tasklist], $web.Lists[$historylist])
    $association.AllowManual = $true
    $_.AddWorkflowAssociation($association)
    $_.Update()
    else
    Write-Error "Workflow Template not found"
    AddWorkflowToLibraries <Site Name> <Content Type Name> <Workflow Template Name> <Association Name>
    However changing the association as follows causes the script to still execute without a problem but the workflow doesn't appear for the content and the associations collection is empty:
    function AddWorkflowToLibraries ($SiteCollection, $ctName, $WfName, $WfAssociationName)
    $site = Get-SPSite $SiteCollection
    [Guid]$wfTemplateId = New-Object Guid
    #Step through each web in site collection
    $site | Get-SPWeb -limit all | ForEach-Object {
    $web = $_
    $_.Lists | ForEach-Object{
    if($_.AllowContentTypes -eq $true)
    if($_.ContentTypes.Item("$ctName") -ne $null)
    write-host "Enabling workflow on" $_.Title "in" $_.ParentWebUrl
    $ct = $_.ContentTypes[$ctName]
    $culture = New-Object System.Globalization.CultureInfo("en-US")
    $template = $site.RootWeb.WorkflowTemplates.GetTemplateByName($WfName, $culture)
    if($template -ne $null)
    $tasklist = "Tasks"
    $historylist = "Workflow History"
    if(!$web.Lists[$historylist])
    $web.Lists.Add($historylist, "A system library used to store workflow history information that is created in this site. It is created by the Publishing feature.",
    "WorkflowHistory", "00BFEA71-4EA5-48D4-A4AD-305CF7030140", 140, "100")
    if (!$web.Features["00BFEA71-4EA5-48D4-A4AD-305CF7030140"]) {
    Enable-SPFeature -Identity WorkflowHistoryList -Url $web.Url
    $wfHistory = $web.Lists[$historylist]
    $wfHistory.Hidden = $true
    $wfHistory.Update()
    if(!$web.Lists[$tasklist])
    $web.Lists.Add($tasklist, "This system library was created by the Publishing feature to store workflow tasks that are created in this site.", "WorkflowTasks", "00BFEA71-A83E-497E-9BA0-7A5C597D0107", 107, "100")
    $association = [Microsoft.SharePoint.Workflow.SPWorkflowAssociation]::CreateListContentTypeAssociation($template, $wfName, $web.Lists[$tasklist], $web.Lists[$historylist])
    $association.AllowManual = $true
    $_.ContentTypes[$ctname].AddWorkflowAssociation($association)
    $_.ContentTypes[$ctname].Update()
    else
    Write-Error "Workflow Template not found"
    AddWorkflowToLibraries <Site Name> <Content Type Name> <Workflow Template Name> <Association Name>
    The only change is:
    $association = [Microsoft.SharePoint.Workflow.SPWorkflowAssociation]::CreateListContentTypeAssociation($template, $wfName, $web.Lists[$tasklist], $web.Lists[$historylist])
    $association.AllowManual = $true
    $_.ContentTypes[$ctname].AddWorkflowAssociation($association)
    $_.ContentTypes[$ctname].Update()
    But unlike the list version, the association doesn't appear to be saved and no error is generated.
    Is anyone aware of what may cause this or have an example in C# that may explain something my script is missing?

    Hi Garry,
    After you associate the workflow to the content type, you should update the update the content type using
    $ct.UpdateWorkflowAssociationsOnChildren($true,$true,$true,$false)
     method.
    Here is the completed script:
    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
    $site=Get-SPSite "http://serverName"
    $web=$site.OpenWeb()
    $list=$web.Lists["ListC"]
    $taskList=$web.Lists["Tasks"]
    $historyList=$web.Lists["Workflow History"]
    $ct=$list.ContentTypes["Link"]
    $culture=New-Object System.Globalization.CultureInfo("en-US")
    $wfTemplate=$web.WorkflowTemplates.GetTemplateByName("Three-State",$culture)
    $associationWF=[Microsoft.SharePoint.Workflow.SPWorkflowAssociation]::CreateListContentTypeAssociation($wfTemplate, "myThreeStateWF",$taskList,$historyList)
    $ct.WorkflowAssociations.Add($associationWF)
    $ct.UpdateWorkflowAssociationsOnChildren($true,$true,$true,$false)
    Here is a demo about how to update it using C#
    http://www.thorntontechnical.com/tech/sharepoint/sharepoint-2010-associate-workflow-to-content-type-in-a-feature
    Wayne Fan
    TechNet Community Support

Maybe you are looking for

  • Adapter module in PI 7.1 EhP1 for Falt File Idoc to Idoc xml transformation

    Hi Experts,                    In PI 7.1 (EhP1) there is a java adapter module that can be added to the file adapter that automatically transforms Flat File representation of IDoc to IDoc XML. Can anyone provide the link to this particular module? Tr

  • ERROR ITMS-9000 for AIR app

    I am getting this error when compiling an IPA with Flash CC 2014, AIR version 15.0: "ERROR ITMS-9000: "This bundle is invalid. The value for key CFBundleShortVersionString [1.0] in the Info.plist file must contain a higher version than that of the pr

  • White Screen At Login

    Hi, I've had this sudden problem when starting up my Windows 7 OS a few days ago. When I start up my computer, it takes a very long time to get to the login screen, and there is a lot of latency when typing in my password to log in. The fingerprint s

  • I cant find home sharing on my computer

    I cannot find home sharing on my computer

  • How to automatically determine batch no. of component  in Production Order

    Hi PP gurus:    I am facing a issue.  A finished goods with a raw material which under batch management, what I want is  when I release the production order of the finished goods, SAP can automatically determine the batch no. of the raw material  acc