Upload file with iframe loos session user and session id in wwv_flow_files

Hello every one, hope someone could help us with this problem.
What we are trying to do is to upload a file from a jquery dialog in a appex page by redirecting the POST action of the wwvFlowForm to the iframe.
*1. In the javascript there is the function call to open my modal window with the input*
function add_fichier_form(numeroProjet,idCat){
     $("#div_upload_fichier").dialog(
                modal : true ,
                autoOpen : false ,
                resizable: false ,
                width: 700         
       $('#div_upload_fichier').parent().appendTo('#div_base');
      $('#upload_button').unbind('click').click(function(){           
          if ($('#P4010_FILE_FICHIER').val() != '') {
               $('#upload_iframe_v2').unbind('load').load(function () {
                    $('#upload_status').html(' déplacement du fichier...');
                    // move the file
                    $('#upload_status').html('Fichier transféré avec succès');
                    //file transfer ok
                    //calling the javascript function to add everything in my own table;
                                 //we see the file in the  wwv_flow_file_objects$ without
                     add_fichier_form_db();
               // set the form target to the iframe, submit, then remove the target
               $('#wwvFlowForm').attr('target','upload_iframe_v2').submit().removeAttr('target');
               $('#upload_status').html(' Téléchargement du fichier...');
          }else {
               alert('Veuillez sélectionner un fichier');
     $("#div_upload_fichier").dialog("option", "title", "Ajout d'un fichier");
        $("#div_upload_fichier").dialog("open");
       }*2. At this point we see the file in the table but without the user and session credential*
select *
    from wwv_flow_file_objects$
The result is that the field security_group_id is assign to 0 AND created_by = APEX_PUBLIC_USER
*3. add_fichier_form_db(); the javascript function making the ajax call to a procedure plsql*
function add_fichier_form_db(){
         //alert ('Dasn fichier form db');
     vNumeroProjet = document.getElementById('P4010_CAT_NUMERO_PROJET').value;
     vIdCat = document.getElementById('P4010_CAT_ID').value;
     vFichierNom = document.getElementById('P4010_NOM_FICHIER').value;
     vFichierDesc = document.getElementById('P4010_DESC_FICHIER').value;
     vFichierFile = document.getElementById('P4010_FILE_FICHIER_NAME').value;
     var ajaxRequest = new htmldb_Get(null , 300, 'APPLICATION_PROCESS=ADD_FICHIER_FORM_DB', 4010);
     ajaxRequest.add( "P4010_CAT_NUMERO_PROJET", vNumeroProjet);
     ajaxRequest.add( "P4010_F_CAT_ID", vIdCat);
     ajaxRequest.add( "P4010_FICHIER_NOM", vFichierNom);
     ajaxRequest.add( "P4010_FICHIER_DESC", vFichierDesc);
     ajaxRequest.add( "P4010_FILE_FICHIER_NAME", vFichierFile);
      var gReturn = ajaxRequest.get();
     if (gReturn){
          $x("getlistfichier").innerHTML = gReturn;
          closeForm();
     }else{
          alert ('Problèmes dans le call Ajax ADD_REPERTOIRE_FORM_DB \n La valeur retournée est: \n' + gReturn);
}*4. PLSQL PROCEDURE *
h1. WHEN the query is executing it's return ORA-01403: no data found. WHY ????
PROCEDURE P_ADD_FICHIER_FORM_DB(
            P_NUMERO_PROJET number,
            P_CAT_ID number,
            P_FICHIER_NOM varchar2,
            P_FICHIER_DESC varchar2,
            P_FILE_FICHIER_NAME in varchar2)
AS
  vNumeroProjet number;
  vFichierNom varchar(255);
  vFichierDesc varchar(2000);
  vCatId number;
  vActif number;
  vDocSize number;
  vNomUsager varchar(10);
  vDateCreation date;
  vFichierTypeId number;
  vNomReel varchar2(1000);
  vNomReel2 varchar2(1000);
  vCurVal number;
  BEGIN
    SELECT FILENAME,DOC_SIZE,CREATED_ON
    INTO
    vNomReel,vDocSize,vDateCreation
    FROM WWV_FLOW_FILES
    WHERE FILENAME = P_FILE_FICHIER_NAME;
/*GET ERROR sqlerrm:ORA-01403: no data found */
  END P_ADD_FICHIER_FORM_DB;h4. hope someone help us soon
Thanks in advance
jocelyn

Finally we find what was wrong so i give you the solution.
In the javascript on the function add_fichier_form
We need to append the div of the form to the default form of apex wwvFlowForm
so the line*
$('#div_upload_fichier').parent().appendTo('#div_base');
should be change to*
$('#div_upload_fichier').parent().appendTo('#wwvFlowForm');Edited by: jocbed on 2012-01-26 11:08

Similar Messages

  • Disable user and session tracking?

    Hi there?
    We would like to use Application Insights for everything except user and session tracking.
    How can i disable these features in AI (we may not use cookies in our site)?
    My guess is to change the applicationinsights.config file as below. Is there any documentation about the configuration file, right now im only guessing...
    Cheers
    /Niclas
    <?xml version="1.0" encoding="utf-8"?>
    <ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings" schemaVersion="2014-05-30">
    <!--
    Learn more about Application Insights configuration with ApplicationInsights.config here:
    http://go.microsoft.com/fwlink/?LinkID=513840
    -->
    <TelemetryModules>
    <Add Type="Microsoft.ApplicationInsights.Extensibility.Implementation.Tracing.DiagnosticsTelemetryModule, Microsoft.ApplicationInsights" />
    <Add Type="Microsoft.ApplicationInsights.Extensibility.RuntimeTelemetry.RemoteDependencyModule, Microsoft.ApplicationInsights.Extensibility.RuntimeTelemetry" />
    <Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCollector.PerformanceCollectorModule, Microsoft.ApplicationInsights.Extensibility.PerfCollector" />
    <Add Type="Microsoft.ApplicationInsights.Extensibility.Web.WebApplicationLifecycleModule, Microsoft.ApplicationInsights.Extensibility.Web" />
    <Add Type="Microsoft.ApplicationInsights.Extensibility.Web.RequestTracking.TelemetryModules.WebRequestTrackingTelemetryModule, Microsoft.ApplicationInsights.Extensibility.Web" />
    <Add Type="Microsoft.ApplicationInsights.Extensibility.Web.RequestTracking.TelemetryModules.WebExceptionTrackingTelemetryModule, Microsoft.ApplicationInsights.Extensibility.Web" />
    <!-- <Add Type="Microsoft.ApplicationInsights.Extensibility.Web.RequestTracking.TelemetryModules.WebSessionTrackingTelemetryModule, Microsoft.ApplicationInsights.Extensibility.Web" />
    <Add Type="Microsoft.ApplicationInsights.Extensibility.Web.RequestTracking.TelemetryModules.WebUserTrackingTelemetryModule, Microsoft.ApplicationInsights.Extensibility.Web" /> -->
    </TelemetryModules>
    <ContextInitializers>
    <Add Type="Microsoft.ApplicationInsights.Extensibility.BuildInfoConfigComponentVersionContextInitializer, Microsoft.ApplicationInsights" />
    <Add Type="Microsoft.ApplicationInsights.Extensibility.DeviceContextInitializer, Microsoft.ApplicationInsights" />
    <Add Type="Microsoft.ApplicationInsights.Extensibility.MachineNameContextInitializer, Microsoft.ApplicationInsights" />
    <Add Type="Microsoft.ApplicationInsights.Extensibility.Web.AzureRoleEnvironmentContextInitializer, Microsoft.ApplicationInsights.Extensibility.Web" />
    </ContextInitializers>
    <TelemetryInitializers>
    <Add Type="Microsoft.ApplicationInsights.Extensibility.Web.TelemetryInitializers.WebOperationNameTelemetryInitializer, Microsoft.ApplicationInsights.Extensibility.Web" />
    <Add Type="Microsoft.ApplicationInsights.Extensibility.Web.TelemetryInitializers.WebOperationIdTelemetryInitializer, Microsoft.ApplicationInsights.Extensibility.Web" />
    <Add Type="Microsoft.ApplicationInsights.Extensibility.Web.TelemetryInitializers.WebUserTelemetryInitializer, Microsoft.ApplicationInsights.Extensibility.Web" />
    <Add Type="Microsoft.ApplicationInsights.Extensibility.Web.TelemetryInitializers.WebSessionTelemetryInitializer, Microsoft.ApplicationInsights.Extensibility.Web" />
    </TelemetryInitializers>
    </ApplicationInsights>

    I'm not sure if we have a documentation about this somewhere yet. But your guess was right. You can remove 2 modules and AI will not read and set cookies.
    Another option is to disable cookie setting but not reading. You would want this if you have JS SDK that sets cookies and you want Web SDK to read it and apply to server telemetry types.
    <Add Type="Microsoft.ApplicationInsights.Extensibility.Web.RequestTracking.TelemetryModules.WebSessionTrackingTelemetryModule, Microsoft.ApplicationInsights.Extensibility.Web" >
    <SetCookie>false</SetCookie>
    </Add>
    There are also 2 telemetry initializers for user and session. They take session and user from RequestTelemetry that was created by WebSdk and initialized in that modules and apply same session to other telemetry types like events and exceptions. If you cut
    modules you can cut telemetry initializers as well.
    Anastasia

  • How to associate an uploaded file with form data

    I have a "ticketing" app which stores a ticket no. as well as allows users to upload multiple files per ticket. The problem I am having is how to associate an uploaded file with a particular ticket no. As you can guess this becomes complicated when the same user can potentially update multiple tickets using the same file names. I am having difficulty trying to understand how to associate a ticket no with one or more uploaded files. I do have a custom table which I update with the attachments but I am unsure how to, or when to, update the ticket information on this custom table. I only want to retrieve attachments for a given ticket, not all attachments uploaded by a user.Does anyone have any ideas?

    Hi,
    My question is bit related to this topic.
    I am having a requirement to upload the CSV files so that they will store in a database table and later on wards when they search on that table it needs to pull the information and display on the form. I am a new bee to application express. Could some body tell me how to start this process with??. Just give me an overvoew/hints so that I will try to carry on my own.
    Cheers,
    Krishna.

  • Impossible Upload files with Filezilla FTP Client after upgrade win8 to win8.1

    Hi
    Things were working fine with win 8 but, after Upgrade to win 8.1 is not possible upload files with Filezilla  FTP Client.
    is there anyone facing same problem?
    thanks in advance for any answer to help me solve this issue 
    Regards 
    TC

    Hi,
    Please Change your transfer settings in site manager from either default or passive to active it to see what's going on.
    Also, check IE compatibility mode.
    In addition, I suggest you install all latest updates for Windows since these updates will improve and fix some known issues.
    Kate Li
    TechNet Community Support

  • Logic to upload file with dynamic columns

    hi
    in my requirement i hav given to add logic to upload file with dynamic columns so that this upload program can be reused.
    this way the program is flexible, irrespective of the number of columns in the file.
    can any one explain this?
    and let me know what actually i hav to do.

    Check the program and the dynamic column is in the col_pos internal table and in the routines get_structure onwards.
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/scm/dynamic%2bstructures%2band%2bcomponents
    cheers
    Aveek

  • Upload files with swedish characters NS 4.7

    Hi,
    I can upload files with swedish characters in the file name with IE 5, but not with Netscape 4.7. iFS presents an error message that the file doesn't exist or is empty.
    Is there a solution for this problem?
    /Elin
    null

    check out if you are using javascripts and whether IE supports it
    Roberto Nanamura <[email protected]> wrote:
    >
    Hi,
    I am having a problem uploading files with Internet Explorer, it works with
    Netscape Communicator. Has someone had the same problem?
    I am using WebLogic 5.1 service pack 5 with Netscape iPlanet 4.1 service pack 2
    in a Solaris 7.
    Best regards,
    Roberto N Nanamura
    Technical Consultant
    Summa Technologies

  • I am trying to organize a zip file with a bunch of links and files. But when I drag an image file to a folder, it always "Snaps to grid" instead of just landing where I put it.

    I am trying to organize a zip file with a bunch of links and files. But when I drag an image file to a folder, it always "Snaps to grid" instead of just landing where I put it. All of the files are going into the same zip file but I want them visually in the space that I put them and not at the bottom of the snap to grid folder location they are looking like.  I am trying to  drag and drop files in groups so that I can group them for now, but image files always do their own "sort by" when I drag them from my web pages. Links don't do it though.  I tried resetting the folder, and deleting the DS files. No luck.

    You keep asking variants on this same question. You've had replies in all your other threads. If you can't find them, go here and click where it says Activity:
    Thomas Cannon Jr.

  • Can all Acrobat Readers open files with mixed orientation pages (portrait and landscape)?

    Can all Acrobat Readers open files with mixed orientation pages (portrait and landscape)? If not, which versions can? Thanks!

    Hi Sami,
    You can open files with mixed page orientations in all Adobe Readers There is no such constraint on opening files with different page orientations in Adobe Readers.
    In case if you have any other query please let us know. We will be happy to assist you.
    Regards,
    Aadesh

  • How to share a project with a non-Adobe user and present it to prospect customers?

    I Have to share my project with a person who will present it to prospect customers. I cannot ask this person to open an Adobe account. Is there a way for him to access my DPS folio and show it? Or can I export it in a way that allows to appreciate the interaction features built inside?
    Thanks!

    OK, got it. Thank you!
    2015-01-17 14:46 GMT+01:00 Bob Levine <[email protected]>:
        How to share a project with a non-Adobe user and present it to
    prospect customers?  created by Bob Levine
    <https://forums.adobe.com/people/BobLevine> in Digital Publishing Suite
    - View the full discussion
    <https://forums.adobe.com/message/7105349#7105349>

  • Upload files with international content

    I want to upload files with international content(many languages), from
    a single JSP. Any ideas?
    thanks,
    M.

    Hi Marco,
    I dont know transaction CV02N. But if this application uses standard function modules like GUI_UPLOAD it should work with ITS. A special configuration should not be required as long as the files have a size up to 5 MB. If they are larger it might be required to adjust the size of the request container MaxReqSize. Dont forget that Java has to be activated to let webgui access the filesystem.
    Regards,
    Klaus

  • Session.putValue() and session.setAttribute

    do I have to use session.putValue() before using session.setAttribute() and session.getAttribute() ?
    becuase I have one JSP page include one form (action=TheSameJspFile.JSP) several Submit bottuns each Bottun has its Value.
    in the JSP I request the submit value and depends on it doing stuff ...
    each Value I have to get and to set a session Attribute, if I want to putValue it will delete the old value.
    how can I solve this?

    You need to store something in the session before you can retrieve it.
    So, you need to do a setAttribute() to place something in the session. Then you use getAttribute() to retrieve it. DO NOT use putValue as it is deprecated and has been replaced by setAttribute(). DO NOT use getValue() as it is deprecated and has been replaced by getAttribute().

  • Powershell: How do I upload files with metadata from a manifest file?

    I am using the script from this blog to try to upload files into SharePoint, using a manifest file to specify the metadata associated with each file. Right now, the script works, but is not populating
    the metadata from the manifest (xml) file. When I write the $metadataManifest variable out to the console, I get the contents of my xml file, so the code is reading the file when it should. However when it gets to the line in bold ($metadataManifest.Columns.Column),
    it does not go into that block...it just skips on to checkin the file. Again the $metadataManifest variable shows all the content in my xml manifest file. Here is what the script looks like...
    #Get web and document library objects
    $web = Get-SPWeb "http://companySite"
    $Library = "My Library"
    $docLibrary = $web.Lists[$Library]
    $ManifestFilePath = "C:\PowerShellScripts\Manifest.xml"
    $LocalPath = "C:\Upload\Test Upload\My Upload Directory\"
    if ($ManifestFilePath)
    $metadataManifest = (Get-Content ($ManifestFilePath))
    write-host "Manifest file: " $metadataManifest
    else
    write-host "Manifest file not specified for categorising uploaded documents"
    #Check for the LibraryStartFolder parameter to specify a root folder
    if ($PSBoundParameters.ContainsKey('LibraryStartFolder')) {
    $folder = $web.GetFolder($docLibrary.Title + $LibraryStartFolder)
    else
    $folder = $docLibrary.RootFolder
    #Attach to local folder and enumerate through all files
    if($IncludeSubFolders) {
    $files = Get-ChildItem $LocalPath -Recurse
    else
    $files = Get-ChildItem $LocalPath
    $files | ForEach-Object {
    #Check if the object is a folder - if so, create it in doc library
    if ($_.PSIsContainer) {
    if (($IncludeSubFolders) -and (!$FlattenStructure)) {
    #Generate folder path for creation in SharePoint
    #by looking at the parent folder on the local path
    $spFolderPath = ($_.Parent.FullName.Replace($LocalPath,"")).Replace("\","/")
    #Get the folder into which the new folder will be created
    #by adding the folder path generated above, if one existed
    if ($spFolderPath -eq "") {
    $currentFolder = $web.GetFolder($folder.Url)
    else
    $currentFolder = $web.GetFolder($folder.Url + $spFolderPath)
    #Check to see if subfolder already exists
    #and create it if not
    $testFolder = $currentFolder.SubFolders[$_.Name]
    if ($testFolder -eq $null) {
    write-host "`nAdding folder" $_.Name "to" $docLibrary.Title "in" $web.Title "..." -foregroundcolor Green
    $newFolder = $currentFolder.SubFolders.Add($_.Name)
    else
    write-host "`nFolder" $_.Name "already exists in" $docLibrary.Title "and shall not be created" -foregroundcolor Red
    else
    #Generate file path for upload into SharePoint
    if ($FlattenStructure) {
    $spFilePath = ("/" + $_.Name)
    else
    $spFilePath = ($_.FullName.Replace($LocalPath,"")).Replace("\","/")
    $spFullPath = $folder.Url + "/" + $spFilePath
    #Check if the file exists and the overwrite option is selected before adding the file
    if ((!$web.GetFile($spFullPath).Exists) -or ($Overwrite)) {
    #Add file
    write-host "`nCopying" $_.Name "to" $spFullPath.Replace("/" + $_.Name,"") "in" $web.Title "..." -foregroundcolor Green
    $spFile = $folder.Files.Add($spFullPath, $_.OpenRead(), $true)
    #$spFile = $folder.Files.Add($folder.Url + "/" + $file.Name, [System.IO.Stream]$fileStream, $true)
    $spItem = $spFile.Item
    #Walk through manifest XML file and configure column values on the file
    $metadataManifest.Columns.Column | ForEach-Object {
    #Single value text columns
    try
    if (($_.Type -eq "Text") -or
    ($_.Type -eq "Choice") -or
    ($_.Type -eq "Boolean") -or
    ($_.Type -eq "Number") -or
    ($_.Type -eq "Currency")) {
    $columnName = $_.Name
    write-host "Setting value on column"$columnName "..." -foregroundcolor Blue
    $_.Values.Value | ForEach-Object {
    $spItem[$columnName] = $_
    write-host "Value set to"$_
    catch {}
    #Multiple line text column
    try
    catch {}
    #Multiple choice columns
    try
    catch {}
    #Hyperlink columns
    try
    catch {}
    #Single User column
    try
    catch {}
    #Multiple User column
    try
    catch {}
    #Single value Managed Metadata column
    try
    catch {}
    #Multi value Managed Metadata column
    try
    catch {}
    #Update document with new column values
    $spItem.SystemUpdate($false)
    #Check in file to document library (if required)
    #MinorCheckIn=0, MajorCheckIn=1, OverwriteCheckIn=2
    if ($CheckIn) {
    if ($spFile.CheckOutStatus -ne "None") {
    $spFile.CheckIn("File copied from " + $filePath, 1)
    write-host $spfile.Name"checked in"
    #Approve file (if required)
    if ($Approve) {
    if ($spItem.ListItems.List.EnableModeration -eq $true) {
    $spFile.Approve("File automatically approved after copying from " + $filePath)
    if ($spItem["Approval Status"] -eq 0) { write-host $spfile.Name"approved" }
    else
    write-host "`nFile"$_.Name "already exists in" $spFullPath.Replace("/" + $_.Name,"") "and shall not be uploaded" -foregroundcolor Red
    $web.Dispose()
    And here is what the manifest file looks like...
    <?xml version="1.0" encoding="utf-8"?>
    <Columns>
    <Column Name="Column1" Type="Text">
    <Values>
    <Value>First File</Value>
    </Values>
    </Column>
    <Column Name="Column2" Type="Text">
    <Values>
    <Value>12585</Value>
    </Values>
    </Column>
    <Column name="Column3" type="Text">
    <Values>
    <Value>Some Data</Value>
    </Values>
    </Column>
    <Column name="Column4" type="Text">
    <Values>
    <Value>More Data</Value>
    </Values>
    </Column>
    </Columns>
    <Columns>
    <Column Name="Column1" Type="Text">
    <Values>
    <Value>Second File</Value>
    </Values>
    </Column>
    <Column Name="Column2" Type="Text">
    <Values>
    <Value>9876</Value>
    </Values>
    </Column>
    <Column name="Column3" type="Text">
    <Values>
    <Value>Some Data2</Value>
    </Values>
    </Column>
    <Column name="Column4" type="Text">
    <Values>
    <Value>More more Data</Value>
    </Values>
    </Column>
    </Columns>
    I can't figure out what am doing wrong...why my script is not iterating through the manifest file to upload the document along with the metadata. I would really appreciate any help. Thanks

    Hi Spawn,
    Name should not be a problem.. I will probably post you the entire code (I modified it to meet your goals for having multiple column xml nodes as well)
    For the code snippet below:
    a. In powershell all my changes will have ## prefixed comments
    b. in XML I have changed one column name to "Name" to replicate your case and also added a parent node for making the xml well formed.
    and the SharePoint output
    Please see the code below
    $web = Get-SPWeb "http://intranet/sites/test"
    $Library = "My Library"
    $docLibrary = $web.Lists[$Library]
    $ManifestFilePath = "D:\Manifest.xml"
    $LocalPath = "D:\UploadPath\"
    if ($ManifestFilePath)
    ##read the xml file as an xml object
    [xml]$metadataManifest = (Get-Content ($ManifestFilePath))
    write-host "Manifest file: " $metadataManifest
    else
    write-host "Manifest file not specified for categorising uploaded documents"
    #Check for the LibraryStartFolder parameter to specify a root folder
    if ($PSBoundParameters.ContainsKey('LibraryStartFolder')) {
    $folder = $web.GetFolder($docLibrary.Title + $LibraryStartFolder)
    else
    $folder = $docLibrary.RootFolder
    #Attach to local folder and enumerate through all files
    if($IncludeSubFolders) {
    $files = Get-ChildItem $LocalPath -Recurse
    else
    $files = Get-ChildItem $LocalPath
    $counter=0
    $files | ForEach-Object {
    #Check if the object is a folder - if so, create it in doc library
    if ($_.PSIsContainer) {
    if (($IncludeSubFolders) -and (!$FlattenStructure)) {
    #Generate folder path for creation in SharePoint
    #by looking at the parent folder on the local path
    $spFolderPath = ($_.Parent.FullName.Replace($LocalPath,"")).Replace("\","/")
    #Get the folder into which the new folder will be created
    #by adding the folder path generated above, if one existed
    if ($spFolderPath -eq "") {
    $currentFolder = $web.GetFolder($folder.Url)
    else
    $currentFolder = $web.GetFolder($folder.Url + $spFolderPath)
    #Check to see if subfolder already exists
    #and create it if not
    $testFolder = $currentFolder.SubFolders[$_.Name]
    if ($testFolder -eq $null) {
    write-host "`nAdding folder" $_.Name "to" $docLibrary.Title "in" $web.Title "..." -foregroundcolor Green
    $newFolder = $currentFolder.SubFolders.Add($_.Name)
    else
    write-host "`nFolder" $_.Name "already exists in" $docLibrary.Title "and shall not be created" -foregroundcolor Red
    else
    #Generate file path for upload into SharePoint
    if ($FlattenStructure) {
    $spFilePath = ("/" + $_.Name)
    else
    $spFilePath = ($_.FullName.Replace($LocalPath,"")).Replace("\","/")
    $spFullPath = $folder.Url + "/" + $spFilePath
    #Check if the file exists and the overwrite option is selected before adding the file
    if ((!$web.GetFile($spFullPath).Exists) -or ($Overwrite)) {
    #Add file
    write-host "`nCopying" $_.Name "to" $spFullPath.Replace("/" + $_.Name,"") "in" $web.Title "..." -foregroundcolor Green
    $spFile = $folder.Files.Add($spFullPath, $_.OpenRead(), $true)
    #$spFile = $folder.Files.Add($folder.Url + "/" + $file.Name, [System.IO.Stream]$fileStream, $true)
    $spItem = $spFile.Item
    ## ensure we pick the corresponding node in the columns xml (first file, first xml node, second file - second node likewise)
    #Walk through manifest XML file and configure column values on the file
    $metadataManifest.FileData.Columns[$counter].Column | ForEach-Object {
    #Single value text columns
    try
    if (($_.Type -eq "Text") -or
    ($_.Type -eq "Choice") -or
    ($_.Type -eq "Boolean") -or
    ($_.Type -eq "Number") -or
    ($_.Type -eq "Currency")) {
    $columnName = $_.Name
    write-host "Setting value on column"$columnName "..." -foregroundcolor Blue
    $_.Values.Value | ForEach-Object {
    $spItem[$columnName] = $_
    write-host "Value set to"$_
    catch {}
    #Multiple line text column
    try
    catch {}
    #Multiple choice columns
    try
    catch {}
    #Hyperlink columns
    try
    catch {}
    #Single User column
    try
    catch {}
    #Multiple User column
    try
    catch {}
    #Single value Managed Metadata column
    try
    catch {}
    #Multi value Managed Metadata column
    try
    catch {}
    #Update document with new column values
    $spItem.SystemUpdate($false)
    ##increment the counter to read the next xml node
    $counter++
    #Check in file to document library (if required)
    #MinorCheckIn=0, MajorCheckIn=1, OverwriteCheckIn=2
    if ($CheckIn) {
    if ($spFile.CheckOutStatus -ne "None") {
    $spFile.CheckIn("File copied from " + $filePath, 1)
    write-host $spfile.Name"checked in"
    #Approve file (if required)
    if ($Approve) {
    if ($spItem.ListItems.List.EnableModeration -eq $true) {
    $spFile.Approve("File automatically approved after copying from " + $filePath)
    if ($spItem["Approval Status"] -eq 0) { write-host $spfile.Name"approved" }
    else
    write-host "`nFile"$_.Name "already exists in" $spFullPath.Replace("/" + $_.Name,"") "and shall not be uploaded" -foregroundcolor Red
    $web.Dispose()
    and the xml file
    <?xml version="1.0" encoding="utf-8"?>
    <FileData>
    <Columns>
    <Column Name="Name" Type="Text">
    <Values>
    <Value>First File</Value>
    </Values>
    </Column>
    <Column Name="Column2" Type="Text">
    <Values>
    <Value>12585</Value>
    </Values>
    </Column>
    <Column name="Column3" type="Text">
    <Values>
    <Value>Some Data</Value>
    </Values>
    </Column>
    <Column name="Column4" type="Text">
    <Values>
    <Value>More Data</Value>
    </Values>
    </Column>
    </Columns>
    <Columns>
    <Column Name="Name" Type="Text">
    <Values>
    <Value>Second File</Value>
    </Values>
    </Column>
    <Column Name="Column2" Type="Text">
    <Values>
    <Value>12585</Value>
    </Values>
    </Column>
    <Column name="Column3" type="Text">
    <Values>
    <Value>Some Data</Value>
    </Values>
    </Column>
    <Column name="Column4" type="Text">
    <Values>
    <Value>More Data</Value>
    </Values>
    </Column>
    </Columns>
    <Columns>
    <Column Name="Name" Type="Text">
    <Values>
    <Value>Third File</Value>
    </Values>
    </Column>
    <Column Name="Column2" Type="Text">
    <Values>
    <Value>12585</Value>
    </Values>
    </Column>
    <Column name="Column3" type="Text">
    <Values>
    <Value>Some Data</Value>
    </Values>
    </Column>
    <Column name="Column4" type="Text">
    <Values>
    <Value>More Data</Value>
    </Values>
    </Column>
    </Columns>
    <Columns>
    <Column Name="Name" Type="Text">
    <Values>
    <Value>Fourth File</Value>
    </Values>
    </Column>
    <Column Name="Column2" Type="Text">
    <Values>
    <Value>12585</Value>
    </Values>
    </Column>
    <Column name="Column3" type="Text">
    <Values>
    <Value>Some Data</Value>
    </Values>
    </Column>
    <Column name="Column4" type="Text">
    <Values>
    <Value>More Data</Value>
    </Values>
    </Column>
    </Columns>
    <Columns>
    <Column Name="Name" Type="Text">
    <Values>
    <Value>Fifth File</Value>
    </Values>
    </Column>
    <Column Name="Column2" Type="Text">
    <Values>
    <Value>12585</Value>
    </Values>
    </Column>
    <Column name="Column3" type="Text">
    <Values>
    <Value>Some Data</Value>
    </Values>
    </Column>
    <Column name="Column4" type="Text">
    <Values>
    <Value>More Data</Value>
    </Values>
    </Column>
    </Columns>
    </FileData>
    Thanks and Regards,
    Partha
    AvePoint

  • Uploading file with an enforced category

    I am trying to upload files to a directory with an enforced category. I took the HandlingEnforcedCategories.java from the DEV Kit, modified to my requirements and still running into issue. It's something to do with library/workspace I think which I am still confused about.
    My sandbox path is /regionUS/BUSINESS%20SECTOR/ (I am escaping the scape or else the api chokes)
    My library/workspace is CUSTOMERS (library/bookshelf icon shows up here)
    My folder where category is applied is COOLEZ which is under CUSTOMERS
    I am trying to upload images and apply category to /regionUS/BUSINESS%20SECTOR/CUSTOMERS/COOLEZ/IMAGES/2009/04
    all the folders exist and the category exist too but I am still getting the error that says
    "Required metadata folder missing. Ensure prerequisite sample has been run."
    The question is why would this complain about the missing metadata folder?
    Here are the couple interested methods
    public static void main(String args[]) {
    try {
    upload ( "coolac",
    "coolpw",
    "http://contentdbserverurl:7779/content/ws",
    "regionUS/BUSINESS%20SECTOR/",
    "CUSTOMERS/COOLEZ/IMAGES/2009/04/",
    "test1.jpg",
    new FileInputStream(new File("c:/test/test1.jpg")),
    "DAMAGED_PRODUCT_IMAGES",
    mapObj
    catch (Exception e) {
    e.printStackTrace();
    } catch (ExelContentDBException e) {
    e.printStackTrace();
    // TODO
    public static void upload(String username,
    String password,
    String contentDBURL,
    String sandboxRootPath,
    String workspaceName,
    String sourceFilename,
    FileInputStream sourceFileInputStream,
    String categoryName,
    Map categoryMap) throws ContentDBException {
    System.out.println("**** : ApplyingCategories: starting");
    FdkCredential credential = new SimpleFdkCredential(username, password);
    ManagersFactory session = null;
    try {
    session = ManagersFactory.login(credential, contentDBURL);
    FileManager fileM = session.getFileManager();
    Item folder = null;
    try {
    Item sandbox = fileM.resolvePath(sandboxRootPath, null);
    // Note: some clients may use the term 'Library' when referring to
    // or displaying a Workspace Item (including the Content DB Web UI).
    //for now I am hardcoding the values
    Item workspace = (sandbox == null) ? null : fileM.resolveRelativePath(sandbox.getId(), "CUSTOMERS", null);
    folder = (workspace == null) ? null : fileM.resolveRelativePath( workspace.getId(), "COOLEZ/IMAGES/2009/04/", null);
    catch (FdkException e) {
    System.out.println("**** : Error locating metadata folder.");
    throw e;
    if (folder == null) {
    throw new ContentDBException("**** : Required metadata folder missing. Ensure prerequisite sample has been run.");
    CommonManager commonM = session.getCommonManager();
    AttributeRequest[] requestedAttributes = AttributeRequests.ITEM_CATEGORY_CONFIGURATION;
    folder = commonM.getItem(folder.getId(),requestedAttributes);
    Item categoryConfiguration = (Item) CommonUtils.getAttribute(folder, Attributes.CATEGORY_CONFIGURATION);
    Map m = CommonUtils.getAttributesMap(categoryConfiguration);
    boolean configEnabled = ((Boolean) m.get(Attributes.CONFIGURATION_ENABLED)).booleanValue();
    Item[] requiredCategories = (Item[]) m.get(Attributes.REQUIRED_CATEGORIES);
    if (configEnabled = false ||
    requiredCategories == null ||
    requiredCategories.length != 1) {
    System.out.println("**** : Category configuration settings unexpected. Has prerequisite samples been run?");
    throw new ContentDBException("Category configuration settings unexpected.");
    requestedAttributes = AttributeRequests.CATEGORY_CLASS_ATTRIBUTES;
    Item catClass = commonM.getItem(requiredCategories[0].getId(), requestedAttributes);
    String displayName = (String) CommonUtils.getAttribute(catClass, Attributes.DISPLAY_NAME);
    if (!displayName.equals(categoryName)) {
    System.out.println("**** : Category configuration settings unexpected. Has prerequisite samples been run?");
    throw new ContentDBException ("Category configuration settings unexpected.");
    // get category metadata attribute internal names from the
    // metadata attribute display names
    // when creating a category instance definition, we specify internal names
    String categoryKeyItems[] = new String[categoryMap.size()];
    Set setObj = categoryMap.keySet();
    Iterator iterObj = setObj.iterator();
    int i = 0;
    while (iterObj.hasNext()) {
    categoryKeyItems[i] = (String) iterObj.next();
    i++;
    Map attributeMap = CategoryUtils.getCategoryAttrInternalNames(session,
    catClass.getId(),
    categoryKeyItems);
    if (attributeMap == null ||
    attributeMap.isEmpty() ) {
    System.out.println("**** : Category class structure invalid.");
    throw new ContentDBException ("Metadata configuration of the required Category class is invalid. Suggested resolution is to drop and recreate category class.");
    requestedAttributes = null;
    Item docDef = fileM.createDocumentDefinition(new NamedValue[] {
    ClientUtils.newNamedValue(Attributes.NAME, sourceFilename),
    ClientUtils.newNamedValue(Options.CONTENTSTREAM,
    sourceFileInputStream)
    }, requestedAttributes);
    // First attempt to createDocument in the enforced metadata folder without
    // supplying a category instance definition.
    // If the enforced metadata folder has been setup correctly, an
    // FdkException with error code ORACLE.FDK.AggregateError will occur
    // containing an FdkExceptionEntry with errorcode ORACLE.FDK.MetaDataError
    // and detailed error code ORACLE.FDK.MetadataRequired. The info
    // NamedValue[] of the FdkExceptionEntry should have a key
    // ECM.EXCEPTIONINFO.MissingMetaData with a long[] value containing the
    // ids of the mandatory category classes for which definition were
    // not supplied.
    Item doc = null;
    NamedValue[] documentDef = new NamedValue[] {
    ClientUtils.newNamedValue(Options.USE_SAVED_DEFINITION,new Long(docDef.getId())),
    ClientUtils.newNamedValue(Options.DESTFOLDER, new Long(folder.getId())),
    try {
    // The following call should FAIL !!! - and exception be caught in
    // catch block
    doc = fileM.createDocument(documentDef, null, null);
    // The following calls should never occur ...
    System.out.println("**** : Document create succeeded.");
    System.out.println("**** : Are there no longer required categories on the folder?");
    catch (FdkException fe) {
    System.out.println("**** : Document create failed (which is what we expected).");
    System.out.println("**** : " + fe);
    // Next, attempt to retry createDocument in the enforced metadata folder
    // this time supplying a category instance definition for the mandatory
    // category class. The advantage of utilizing document definitions is
    // that the content does not need to be reuploaded. The document
    // definition can be reused when retrying the failed operation.
    NamedValue[] categoryInstanceAttributes = new NamedValue[categoryKeyItems.length];
    for (int x=0; x < categoryKeyItems.length; x++) {
    categoryInstanceAttributes[x] = (NamedValue) categoryMap.get(categoryKeyItems[x]);
    NamedValue[] categoryDef = new NamedValue[] {
    ClientUtils.newNamedValue(Options.CATEGORY_CLASS_ID,
    new Long(catClass.getId())),
    ClientUtils.newNamedValue(Options.CATEGORY_DEFINITION_ATTRIBUTES,
    categoryInstanceAttributes)
    documentDef = new NamedValue[] {
    ClientUtils.newNamedValue(Options.USE_SAVED_DEFINITION,new Long(docDef.getId())),
    ClientUtils.newNamedValue(Options.DESTFOLDER, new Long(folder.getId())),
    ClientUtils.newNamedValue(Options.CATEGORY_DEFINITION, categoryDef)
    System.out.println("**** : Create a Document using saved definition item ...");
    requestedAttributes = AttributeRequests.DOCUMENT_CATEGORY_ATTRIBUTES;
    doc = fileM.createDocument(documentDef, null, requestedAttributes);
    catch (Throwable t)
    t.printStackTrace();
    finally
    CommonUtils.bestEffortLogout(session);
    System.out.println("**** : ApplyingCategories: done");
    }

    I finally got the code working that uploads a file with the attached catogory values. The problem was the internalAttributeMap that had to be created with CategoryUtils.getCategoryAttrInternalNames
    I will post the code later with some cleanup. The documentation is not very friendly. The example code is very confusing. I don't have any books on it and I didn't go to any of Oracle's training either.
    Do you guys know of any good books, sites or blogs on development with Cotnent DB?

  • How to upload file from desktop or C drive and send as attachments

    Hello Experts,
    Please tell me
    How to upload jpg or gif or drawing files from desktop or any drive and store into R/3 by the same time I have to send mail as a attachment.
    I heard that FM
    SO_NEW_DOCUMENT_ATT_SEND_API1  is only to send as a  attachment what ever the data is present in the internal table only.
    please help me on that.

    I m using this code its having attachment but I m not able to open the file. Please help me
    I m using gui_upload to upload the file
    PROGRAM  ZTEST
           no standard page heading line-size 255.
    DATA: xfile TYPE string.
    data :     t_IW51 LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
    DATA: OBJPACK   LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
    DATA: OBJHEAD   LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
    DATA: OBJBIN    LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
    DATA: OBJTXT    LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
    DATA: RECLIST   LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
    DATA: DOC_CHNG  LIKE SODOCCHGI1.
    DATA: TAB_LINES LIKE SY-TABIX.
    data :  email type table of BAPIADSMTP.
    PARAMETERS : file LIKE rlgrap-filename OBLIGATORY.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR file.
      CLEAR file.
      CALL FUNCTION 'F4_FILENAME'
        IMPORTING
          file_name = file.
      xfile = file.
    START-OF-SELECTION.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename            = xfile
          filetype            = 'ASC'
          has_field_separator = 'X'
        TABLES
          data_tab            = t_IW51.
    Creation of the document to be sent
    File Name
      DOC_CHNG-OBJ_NAME = 'SENDFILE'.
    Mail Subject
      DOC_CHNG-OBJ_DESCR = 'Send External Mail'.
    Mail Contents
      OBJTXT = 'Minimum bid : $250000'.
      APPEND OBJTXT.
      OBJTXT = 'A representation of the pictures up for auction'.
      APPEND OBJTXT.
      OBJTXT = 'was included as attachment.'.
      APPEND OBJTXT.
      DESCRIBE TABLE OBJTXT LINES TAB_LINES.
      READ TABLE OBJTXT INDEX TAB_LINES.
      DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
    Creation of the entry for the compressed document
      CLEAR OBJPACK-TRANSF_BIN.
      OBJPACK-HEAD_START = 1.
      OBJPACK-HEAD_NUM = 0.
      OBJPACK-BODY_START = 1.
      OBJPACK-BODY_NUM = TAB_LINES.
      OBJPACK-DOC_TYPE = 'RAW'.
      APPEND OBJPACK.
    Creation of the document attachment
    (Assume that the data in OBJBIN is in BMP format)
    *OBJBIN = ' \O/ '. APPEND OBJBIN.
    *OBJBIN = ' | '. APPEND OBJBIN.
    *OBJBIN = ' / \ '. APPEND OBJBIN.
      OBJBIN[] = t_IW51[].
      DESCRIBE TABLE OBJBIN LINES TAB_LINES.
      OBJHEAD = 'PICTURE.PDF'.
      APPEND OBJHEAD.
      OBJBIN[] = t_IW51[].
    Creation of the entry for the compressed attachment
      OBJPACK-TRANSF_BIN = 'X'.
      OBJPACK-HEAD_START = 1.
      OBJPACK-HEAD_NUM = 1.
      OBJPACK-BODY_START = 1.
      OBJPACK-BODY_NUM = TAB_LINES.
      OBJPACK-DOC_TYPE = 'PDF'.
      OBJPACK-OBJ_NAME = 'PICTURE'.
      OBJPACK-OBJ_DESCR = 'Representation of object 138'.
      OBJPACK-DOC_SIZE = TAB_LINES * 255.
      APPEND OBJPACK.
    Completing the recipient list
      RECLIST-RECEIVER = 'email_id have to enter here'.
      RECLIST-REC_TYPE = 'U'.
      APPEND RECLIST.
      RECLIST-RECEIVER = 'ENTEG01'.
      RECLIST-REC_TYPE = 'P'.
      APPEND RECLIST.
    Sending the document
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
         DOCUMENT_DATA = DOC_CHNG
         PUT_IN_OUTBOX = 'X'
         commit_work = 'X'
      TABLES
         PACKING_LIST = OBJPACK
         OBJECT_HEADER = OBJHEAD
         CONTENTS_BIN = OBJBIN
         CONTENTS_TXT = OBJTXT
         RECEIVERS = RECLIST
    *EXCEPTIONS
      TOO_MANY_RECEIVERS = 1
      DOCUMENT_NOT_SENT = 2
      OPERATION_NO_AUTHORIZATION = 4
    *OTHERS = 99.
      CASE SY-SUBRC.
        WHEN 0.
          WRITE: / 'Result of the send process:'.
          LOOP AT RECLIST.
            WRITE: / RECLIST-RECEIVER(48), ':'.
            IF RECLIST-RETRN_CODE = 0.
              WRITE 'The document was sent'.
            ELSE.
              WRITE 'The document could not be sent'.
            ENDIF.
          ENDLOOP.
        WHEN 1.
          WRITE: / 'No authorization for sending to the specified number',
                   'of recipients'.
        WHEN 2.
          WRITE: / 'Document could not be sent to any recipient'.
        WHEN 4.
          WRITE: / 'No send authorization'.
        WHEN OTHERS.
          WRITE: / 'Error occurred while sending'.
      ENDCASE.

  • GP: Creation of process for uploading file with approval or a rejection

    Problem: It is necessary to organise process of uploading files in KM repository with approval or a rejection.
    I have created process with two callable objects.
    1. File Input
    2. Interactive Form/File Approval
    Has grouped structure "File"
    In Runtime, during object performance "Interactive Form/File Approval" there is an error:
    com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: pdfSource of InteractiveForm UI element should be populated with pdf binary content in USE_PDF mode
    It is one problem, the second problem consists in that how to organise a folder choice where the file will be loaded.

    Hi Pustovoytov Stanislav ,
    Check whether if the context attribute pdfsource is of binary type or any other type. It sbould be of binary type.
    And about the second one you can organize the folder structure in the KM administration.
    Thanks
    Satya

Maybe you are looking for

  • PSE 6.0 will not import JPG's, or .3gp videos, from Motorola Droid

    I'm using Windows Vista 32-bit. I've tried a number of ways to import pictures (jpg's) from my Motorola Droid: 1)  Bu using a USB cable connection to the phone. 2)  By taking the microSD card out of phone and inserting it into a card reader. 3)  By c

  • How can I use the American gift card to use it in the Russian iTunes?

    I have got the itunes gift in the USA, but I need do exchange it to use it in Russuan store. How I can do it?

  • REP-501: Unable to connect to the specified data

    i found this error when i try to run reports in 11g-->> REP-501: Unable to connect to the specified data kindly provide solution regarding the same.

  • Uneven Column Width and Spanning

    So, I would like to create a grid with two columns of different widths. From what I can tell, the only way to do this is to manually adjust column guides on a master page and then flow in my text. The only problem is that InDesign creates separate fr

  • Pou Session  in bean

    Hi In my loion page I have bean. In bean I have methods for connection to database and checking username and password. I would like when I take user id to put in session in bean. Is it posible at all??? If it is how??