Document library authorization

Hello everybody ! 
I've a problem regarding to the Sharepoint authorization system, I've a folder inside a document library and users can upload documents inside, but the content of this folder must be invisible, only files that the user has uploaded can be visible. How can i
do ? What kind of authorization should i implement ? Is it possible without coding ?
Thanks in advance.
Best regards.

Hello,
>the idea is to grant write permission but not read permission (basically)
write permission to whom? If user has uploaded the file and if you want to allow owner of that file to read and write the file then you have to set "Create items and edit items that were created by the user" security.
By default  item level permission is not visible in advance setting for doc lib (only available for list) so you have to use powershell script to set this security. Please follow the link:
http://www.hersheytech.com/Blog/SharePoint/tabid/197/entryid/28/Default.aspx
Let us know in case any doubt
Hemendra:Yesterday is just a memory,Tomorrow we may never see
Please remember to mark the replies as answers if they help and unmark them if they provide no help

Similar Messages

  • Packaged App Document Library 0.91 installs with errors in Apex 3.0

    Hello All,
    I get these errors when I try to install Document Library packaged application in Apex 3.0
    Script name          success          errors          total
    tab.sql               137          1          137
    doclib.pkb          0          1          1
    sync_index.sql          1          1          2
    When I try to run the app, I am prompted for user name and password. I enter the user name I’ve selected during the install process as parsing schema, and I get this error:
    ORA-04063: package body "DOADMIN.DOCLIB" has errors ORA-06508: PL/SQL: could not find program unit being called: "DOADMIN.DOCLIB"
    ERR-1082 Error in executing authorization scheme code.
    How can I find the object that caused errors during install? Is there any installation log?
    Thank you,
    Daniel

    I’ve attempted to install the document library app into completely new workspace, with new parsing user. I still get the same errors:
    Errors     
    tab.sql
    create index doclib_docs_idx2 on doclib_documents(contents) indextype is ctxsys.context
    ORA-29833: indextype does not exist
    doclib.pkb
    create or replace package body doclib as
    g_html_email_header constant varchar2(4000) := '<html lang="en-us" xmlns:htmldb="http://htmldb.oracle.com">
    <head>
    <style type="text/css">
    *{font-size:12px;font-family:Arial, Helvetica, Geneva, sans-serif;}
    body{background-color:#fff;margin:0;padding:0;font-family:Arial, Helvetica, Geneva, sans-serif;font-size:12px;}
    body *{font-size:12px;}
    img{border:0;margin:0;}
    hr{color:#bbb;height:1px;}
    br{clear:both;}
    p{font-size:12px;}
    a:link,a:visited{text-decoration:none;font-size:-1;color:#7f7f7f;}
    a:active,a:hover{text-decoration:underline;font-size:-1;color:#ff6600;}
    </style>
    <title></title>
    <body>';
    g_html_email_footer constant varchar2(30) := '</body></html>';
    function get_member_id (
    p_user_name in varchar2
    ) return number
    is
    l_user_id number;
    begin
    for c1 in (select user_id
    from doclib_members
    where upper(p_user_name) = user_name ) loop
    l_user_id := c1.user_id;
    end loop;
    return l_user_id;
    end get_member_id;
    function get_member_email (
    p_user_name in varchar2
    ) return varchar2
    is
    l_email varchar2(255);
    begin
    for c1 in (select email_address
    from doclib_members
    where upper(p_user_name) = user_name ) loop
    l_email := c1.email_address;
    end loop;
    return l_email;
    end get_member_email;
    function get_acl_id (
    p_user_name in varchar2
    ) return number
    is
    l_acl_id number := 0;
    begin
    for c1 in (select role_id
    from doclib_members
    where upper(p_user_name) = user_name ) loop
    l_acl_id := c1.role_id;
    end loop;
    return l_acl_id;
    return 3;
    end get_acl_id;
    function get_local_name (
    p_filename in varchar2
    ) return varchar2
    is
    begin
    return substr(p_filename,instr(p_filename,'/')+1);
    end get_local_name;
    function doc_is_checkedout_by (
    p_doc_id in varchar2
    ) return varchar2
    is
    begin
    for c1 in (select checkedout_by
    from doclib_documents
    where doc_id = p_doc_id ) loop
    return c1.checkedout_by;
    end loop;
    return null;
    end doc_is_checkedout_by;
    function get_doc_name (
    p_doc_id in varchar2
    ) return varchar2
    is
    begin
    for c1 in (select name
    from doclib_documents
    where doc_id = p_doc_id ) loop
    return c1.name;
    end loop;
    return null;
    end get_doc_name;
    function doc_already_exists (
    p_name in varchar2
    ) return boolean
    is
    begin
    for c1 in (select null
    from doclib_documents
    where name = p_name ) loop
    return true;
    end loop;
    return false;
    end doc_already_exists;
    function alert_todo_already_exists (
    p_user_id in number
    ) return boolean
    is
    l_found boolean := false;
    begin
    for c1 in (select null
    from doclib_alerts a, doclib_alerts_todo b
    where a.alert_id = b.alert_id
    and a.doctask_id = 0
    and a.user_id = p_user_id ) loop
    l_found := true;
    exit;
    end loop;
    return l_found;
    end alert_todo_already_exists;
    function parse_search_string(
    p_search_str in varchar2 ) return varchar2
    is
    l_temp_value varchar2(1000);
    l_temp_value2 varchar2(1000);
    l_return_value varchar2(1000) := NULL;
    l_start_token number := 1;
    l_in_token boolean := FALSE;
    l_quotes number;
    l_phrases dbms_sql.varchar2s;
    n number;
    begin
    if nvl(length(p_search_str),0) = 0 then
    return NULL;
    end if;
    l_quotes := length(p_search_str) - length(replace(p_search_str,'"', ''));
    if ( l_quotes > 0 and mod(l_quotes,2) = 0 ) then
    l_temp_value2 := lower(p_search_str);
    for i in 1 .. l_quotes/2 loop
    n := instr( l_temp_value2, '"' );
    l_temp_value := l_temp_value || substr( l_temp_value2, 1, n-1 );
    l_temp_value2 := substr( l_temp_value2, n+1 );
    n := instr( l_temp_value2, '"' );
    l_phrases(i) := substr( l_temp_value2, 1, n-1 );
    l_temp_value2 := substr( l_temp_value2, n+1 );
    end loop;
    l_temp_value := l_temp_value || l_temp_value2;
    else
    l_temp_value := lower(p_search_str);
    end if;
    l_temp_value := trim(replace( l_temp_value, ':', ' '));
    l_temp_value := trim(replace( l_temp_value, ';', ' '));
    l_temp_value := trim(replace( l_temp_value, '"', ' '));
    l_temp_value := trim(replace( l_temp_value, ':'',', ' '));
    l_temp_value := trim(replace( l_temp_value, '(', ' '));
    l_temp_value := trim(replace( l_temp_value, ')', ' '));
    l_temp_value := trim(replace( l_temp_value, '!', ' '));
    l_temp_value := trim(replace( l_temp_value, '&', ' '));
    l_temp_value := trim(replace( l_temp_value, '+', ' '));
    l_temp_value := trim(replace( l_temp_value, '-', ' '));
    l_temp_value := trim(replace( l_temp_value, ',', ' '));
    l_temp_value := trim(replace( l_temp_value, '\', ' '));
    l_temp_value := trim(replace( l_temp_value, ' and ', ' ' ));
    l_temp_value := trim(replace( l_temp_value, ' or ', ' ' ));
    if length(l_temp_value) > 0 then
    l_in_token := TRUE;
    end if;
    for i in 1..nvl(length(l_temp_value),0) loop
    if substr(l_temp_value,i,1) = ' ' then
    if l_in_token = TRUE then
    l_return_value := l_return_value || '{' || substr(l_temp_value,l_start_token, i-l_start_token) || '}' || ' and ';
    l_in_token := FALSE;
    end if;
    elsif l_in_token = FALSE then
    l_in_token := TRUE;
    l_start_token := i;
    end if;
    end loop;
    if l_in_token = TRUE then
    l_return_value := l_return_value || '{' || substr(l_temp_value,l_start_token) || '} and ';
    end if;
    for i in 1 .. nvl(l_phrases.count,0) loop
    l_return_value := l_return_value || ' {' || l_phrases(i) || '} and ';
    end loop;
    return trim( substr( l_return_value, 1, length(l_return_value)-4 ) );
    end parse_search_string;
    function doc_has_revisions (
    p_doc_id in varchar2
    ) return number
    is
    l_revisions number := 0;
    begin
    for c1 in (select count(*) cnt
    from doclib_documents
    where deleted_as_of = to_date('22-04-2004','DD-MM-YYYY')
    and revision_of = p_doc_id ) loop
    l_revisions := c1.cnt;
    end loop;
    return l_revisions;
    end doc_has_revisions;
    function get_checkout_list (
    p_user_name in varchar2
    ) return varchar2
    is
    l_chkout_lst varchar2(32000);
    begin
    for c1 in (select '<li>'||name||'</li>' name
    from doclib_documents
    where deleted_as_of = to_date('22-04-2004','DD-MM-YYYY')
    and revision_of = 0
    and checkedout_by = p_user_name ) loop
    l_chkout_lst := l_chkout_lst || c1.name;
    end loop;
    if l_chkout_lst is null then
    l_chkout_lst := 'None.';
    else
    l_chkout_lst := '<ul>'||l_chkout_lst||'</ul>';
    end if;
    return l_chkout_lst;
    end get_checkout_list;
    procedure return_xml (
    p_doc_id in number,
    p_action in varchar2,
    p_message in varchar2,
    p_chkout_lst in varchar2,
    p_result in varchar2,
    p_user_name in varchar2
    is
    begin
    owa_util.mime_header('text/xml', FALSE );
    htp.p('Cache-Control: no-cache');
    htp.p('Pragma: no-cache');
    owa_util.http_header_close;
    htp.p('<div class="return" id="'||p_doc_id||'" action="'||p_action||'" result="'||p_result||'">');
    htp.p('<div class="message" id="primary">'||p_message||'</div>');
    htp.p('<div class="message" id="chkoutlst">'||p_chkout_lst||'</div>');
    htp.p('<div id="checkoutby">'||p_user_name||'</div>');
    htp.p('<div id="modifiedby">'||p_user_name||'</div>');
    htp.p('</div>');
    end;
    procedure add_document (
    p_doc_id in varchar2 default null,
    p_name in varchar2 default null,
    p_filename in varchar2,
    p_user_name in varchar2,
    p_description in varchar2,
    p_attr1 in varchar2,
    p_attr2 in varchar2,
    p_attr3 in varchar2
    is
    l_content blob;
    l_mime_type varchar2(48);
    l_name varchar2(255);
    begin
    if get_acl_id(p_user_name) < 2 then
    raise_application_error(-20001,'You are not authorized to add documents.');
    end if;
    if p_name is null then
    l_name := get_local_name(p_filename);
    for c1 in (select doc_id, name
    from doclib_documents
    where revision_of = 0
    and name = l_name ) loop
    --document already exists, so update it
    update_document(c1.doc_id, c1.name, p_filename, p_user_name, p_description, p_attr1, p_attr2, p_attr3);
    goto end_add;
    end loop;
    else
    l_name := p_name;
    end if;
    for c1 in (select mime_type, blob_content
    from apex_application_files
    where name = p_filename ) loop
    l_content := c1.blob_content;
    l_mime_type := c1.mime_type;
    end loop;
    insert
    into doclib_documents (doc_id, name, description, mime_type, contents, attr1, attr2, attr3)
    values (p_doc_id, l_name, p_description, l_mime_type, l_content, p_attr1, p_attr2, p_attr3);
    delete
    from apex_application_files
    where name = p_filename;
    if p_name is null then
    do_alerts('D',0,null);
    end if;
    commit;
    <<end_add>>
    null;
    exception when others then
    raise_application_error(-20001, 'Exception encountered adding document: '||sqlerrm);
    end add_document;
    procedure add_member (
    p_user_name in varchar2,
    p_member in varchar2,
    p_email in varchar2,
    p_acl_id in varchar2
    is
    begin
    if get_acl_id(p_user_name) < 3 then
    raise_application_error(-20001,'You are not authorized to add members.');
    end if;
    insert
    into doclib_members (user_name, email_address, role_id)
    values (p_member, p_email, p_acl_id);
    commit;
    exception when dup_val_on_index then
    raise_application_error(-20001,'The user is already a member of this workspace.');
    when others then
    raise_application_error(-20001,'Exception encountered adding member: '||sqlerrm);
    end add_member;
    procedure add_task (
    p_user_name in varchar2,
    p_assigned_to in varchar2,
    p_name in varchar2,
    p_description in varchar2,
    p_start_date in varchar2,
    p_end_date in varchar2,
    p_priority in varchar2,
    p_status in varchar2,
    p_pct_complete in varchar2,
    p_doc_id in varchar2
    is
    l_start_date date;
    l_due_date date;
    begin
    if get_acl_id(p_user_name) < 2 then
    raise_application_error(-20001,'You are not authorized to add tasks.');
    end if;
    l_start_date := to_date(p_start_date,'DD-MM-YYYY HH24:MI');
    l_due_date := to_date(p_end_date, 'DD-MM-YYYY HH24:MI');
    insert
    into doclib_tasks (assigned_to, name, description, start_date, due_date, priority_id, status_id, pct_complete, doc_id)
    values (p_assigned_to, p_name, p_description, l_start_date, l_due_date, p_priority, p_status, p_pct_complete, p_doc_id);
    do_alerts('T',0,null);
    commit;
    exception when others then
    raise_application_error(-20001,'Exception encountered adding task: '||sqlerrm);
    end add_task;
    procedure add_link (
    p_user_name in varchar2,
    p_name in varchar2,
    p_url in varchar2
    is
    begin
    if get_acl_id(p_user_name) < 2 then
    raise_application_error(-20001,'You are not authorized to add links.');
    end if;
    insert
    into doclib_links (name, url)
    values (p_name, p_url);
    commit;
    exception when others then
    raise_application_error(-20001,'Exception encountered adding link: '||sqlerrm);
    end add_link;
    procedure add_announcement (
    p_user_name in varchar2,
    p_title in varchar2,
    p_description in varchar2,
    p_expire_date in varchar2
    is
    l_expire_date date;
    begin
    if get_acl_id(p_user_name) < 2 then
    raise_application_error(-20001,'You are not authorized to add announcements.');
    end if;
    l_expire_date := to_date(p_expire_date,'DD-MM-YYYY HH24:MI');
    insert
    into doclib_announcements (title, description, expire_date)
    values (p_title, p_description, l_expire_date);
    commit;
    exception when others then
    raise_application_error(-20001,'Exception encountered adding announcement: '||sqlerrm);
    end add_announcement;
    procedure add_alert (
    p_user_name in varchar2,
    p_alert_type in varchar2,
    p_alert_interval in varchar2,
    p_doctask_id in varchar2
    is
    l_user_id number;
    begin
    l_user_id := get_member_id(p_user_name);
    insert
    into doclib_alerts (user_id, alert_type, alert_interval, doctask_id)
    values (l_user_id, p_alert_type, p_alert_interval, p_doctask_id);
    commit;
    exception when others then
    raise_application_error(-20001,'Exception adding alert: '||sqlerrm);
    end add_alert;
    procedure delete_alert (
    p_alert_id in varchar2
    is
    begin
    delete
    from doclib_alerts
    where alert_id = p_alert_id;
    commit;
    end delete_alert;
    procedure do_alerts (
    p_alert_type in varchar2,
    p_doctask_id in number,
    p_newdoc_id in number default null
    is
    l_subject varchar2(2000);
    l_url varchar2(4000);
    l_body clob;
    l_body_html clob;
    begin
    l_body := ' ';
    if p_alert_type = 'D' then
    --Do document alerts on specific document
    if p_doctask_id != 0 then
    for c1 in (select c.email_address, c.user_id, b.name, a.alert_interval, a.alert_id
    from doclib_alerts a, doclib_documents b, doclib_members c
    where a.alert_type = p_alert_type
    and a.doctask_id = b.doc_id
    and a.user_id = c.user_id
    and a.doctask_id = p_doctask_id ) loop
    l_subject := 'Document '||c1.name||' has been updated.';
    l_url := v('BASE_URL')||'/f?p='||v('APP_ID')||':2:::::P2_DOC_ID:'||p_newdoc_id;
    l_body_html := g_html_email_header||'<p />'||l_subject||'<p />Click to view.'||
    g_html_email_footer;
    if c1.alert_interval = 'I' then
    apex_mail.send(
    p_to => c1.email_address,
    p_from => c1.email_address,
    p_body => l_body,
    p_body_html => l_body_html,
    p_subj => l_subject );
    else --it is a daily alert, insert into todos
    if not alert_todo_already_exists(c1.user_id) then --make sure non-specific daily alert isn't already recorded
    insert
    into doclib_alerts_todo (alert_id, alert_url)
    values (c1.alert_id, l_url);
    end if;
    end if;
    end loop;
    update doclib_alerts
    set doctask_id = p_newdoc_id
    where alert_type = 'D'
    and doctask_id = p_doctask_id;
    end if;
    --Do document alerts on generic documents
    for c1 in (select c.email_address, c.user_id, a.alert_id, a.alert_interval
    from doclib_alerts a, doclib_members c
    where a.alert_type = p_alert_type
    and a.doctask_id = 0
    and a.user_id = c.user_id ) loop
    l_subject := 'A document has been added or updated in the document workspace.';
    l_url := v('BASE_URL')||'/f?p='||v('APP_ID')||':1';
    l_body_html := g_html_email_header||'<p />'||l_subject||'<p />Click to view.'||
    g_html_email_footer;
    if c1.alert_interval = 'I' then
    apex_mail.send(
    p_to => c1.email_address,
    p_from => c1.email_address,
    p_body => l_body,
    p_body_html => l_body_html,
    p_subj => l_subject );
    else --it is a daily alert, insert into todos
    if not alert_todo_already_exists(c1.user_id) then --make sure non-specific daily alert isn't already recorded
    insert
    into doclib_alerts_todo (alert_id, alert_url)
    values (c1.alert_id, l_url);
    end if;
    end if;
    end loop;
    else
    if p_doctask_id != 0 then
    --Do task alerts on specific tasks
    for c1 in (select c.email_address, c.user_id, b.name, a.alert_interval, a.alert_id
    from doclib_alerts a, doclib_tasks b, doclib_members c
    where a.alert_type = p_alert_type
    and a.doctask_id = b.task_id
    and a.user_id = c.user_id
    and a.doctask_id = p_doctask_id ) loop
    l_subject := 'Task '||c1.name||' has been updated.';
    l_url := v('BASE_URL')||'/f?p='||v('APP_ID')||':75:::::P75_TASK_ID:'||p_doctask_id;
    l_body_html := g_html_email_header||'<p />'||l_subject||'<p />Click to view.'||
    g_html_email_footer;
    if c1.alert_interval = 'I' then
    apex_mail.send(
    p_to => c1.email_address,
    p_from => c1.email_address,
    p_body => l_body,
    p_body_html => l_body_html,
    p_subj => l_subject );
    else --it is a daily alert, insert into todos
    if not alert_todo_already_exists(c1.user_id) then --make sure non-specific daily alert isn't already recorded
    insert
    into doclib_alerts_todo (alert_id, alert_url)
    values (c1.alert_id, l_url);
    end if;
    end if;
    end loop;
    end if;
    --Do task alerts on generic tasks
    for c1 in (select c.email_address, c.user_id, a.alert_id, a.alert_interval
    from doclib_alerts a, doclib_members c
    where a.alert_type = p_alert_type
    and a.doctask_id = 0
    and a.user_id = c.user_id ) loop
    l_subject := 'A task has been added or updated in the document workspace.';
    l_url := v('BASE_URL')||'/f?p='||v('APP_ID')||':1';
    l_body_html := g_html_email_header||'<p />'||l_subject||'<p />Click to view.'||
    g_html_email_footer;
    if c1.alert_interval = 'I' then
    apex_mail.send(
    p_to => c1.email_address,
    p_from => c1.email_address,
    p_body => l_body,
    p_body_html => l_body_html,
    p_subj => l_subject );
    else --it is a daily alert, insert into todos
    if not alert_todo_already_exists(c1.user_id) then --make sure non-specific daily alert isn't already recorded
    insert
    into doclib_alerts_todo (alert_id, alert_url)
    values (c1.alert_id, l_url);
    end if;
    end if;
    end loop;
    end if;
    end do_alerts;
    procedure do_alert_todos
    is
    l_subject varchar2(2000);
    l_body clob;
    l_body_html clob;
    begin
    wwv_flow_api.set_security_group_id;
    l_body := ' ';
    l_subject := 'Documents or tasks have been updated.';
    for c1 in (select distinct(c.email_address), b.user_id
    from doclib_members c, doclib_alerts b, doclib_alerts_todo a
    where a.alert_id = b.alert_id
    and b.user_id = c.user_id ) loop
    l_body_html := g_html_email_header||'<p />The following documents or tasks have been added or updated.';
    for c2 in (select b.alert_url
    from doclib_alerts a, doclib_alerts_todo b
    where a.alert_id = b.alert_id
    and a.user_id = c1.user_id ) loop
    l_body_html := l_body_html || '<p />'||c2.alert_url||'';
    end loop;
    l_body_html := l_body_html ||g_html_email_footer;
    apex_mail.send(
    p_to => c1.email_address,
    p_from => c1.email_address,
    p_body => l_body,
    p_body_html => l_body_html,
    p_subj => l_subject );
    end loop;
    delete from doclib_alerts_todo;
    commit;
    end do_alert_todos;
    procedure update_document (
    p_doc_id in varchar2,
    p_name in varchar2,
    p_filename in varchar2,
    p_user_name in varchar2,
    p_description in varchar2,
    p_attr1 in varchar2,
    p_attr2 in varchar2,
    p_attr3 in varchar2
    is
    l_doc_id number;
    l_checked_out_by varchar2(255);
    l_mime_type varchar2(48);
    l_cnt number;
    l_num_over number;
    begin
    if get_acl_id(p_user_name) < 2 then
    raise_application_error(-20001,'You are not authorized to update documents.');
    end if;
    l_checked_out_by := doc_is_checkedout_by(p_doc_id);
    --this can be optimistic locking mechanism
    if l_checked_out_by is not null and upper(l_checked_out_by) != upper(p_user_name) then
    raise_application_error(-20001,'This document is locked by '||l_checked_out_by);
    end if;
    for c1 in (select mime_type
    from apex_application_files
    where name = p_filename ) loop
    l_mime_type := c1.mime_type;
    end loop;
    for c1 in (select mime_type
    from doclib_documents
    where doc_id = p_doc_id ) loop
    if l_mime_type != c1.mime_type then
    delete
    from apex_application_files
    where name = p_filename;
    raise_application_error(-20001,'The document type to be checked in does not match the document type of the original document.');
    end if;
    end loop;
    if l_checked_out_by is not null then
    checkin(p_doc_id, p_user_name);
    end if;
    l_doc_id := doclib_nextval;
    add_document(l_doc_id, p_name, p_filename, p_user_name, p_description, p_attr1, p_attr2, p_attr3);
    update doclib_documents
    set revision_of = l_doc_id
    where doc_id = p_doc_id;
    l_cnt := 1;
    for c1 in (select count(*) cnt
    from doclib_documents
    where revision_of != 0
    and deleted_as_of = to_date('22-04-2004','DD-MM-YYYY') -- don't count logically deleted docs
    and name = p_name ) loop
    l_cnt := l_cnt + c1.cnt;
    end loop;
    --check whether we have hit max revisions as defined in workspace setting
    if v('DOC_WORKSPACE_VERSIONS') != '0' and l_cnt > to_number(v('DOC_WORKSPACE_VERSIONS')) then
    l_num_over := l_cnt - to_number(v('DOC_WORKSPACE_VERSIONS'));
    for c2 in (select doc_id
    from (select doc_id
    from doclib_documents
    where name = p_name
    order by version_no)
    where rownum <= l_num_over ) loop
    delete
    from doclib_documents
    where doc_id = c2.doc_id;
    end loop;
    end if;
    update doclib_documents
    set revision_of = l_doc_id
    where (revision_of != 0 or deleted_as_of != to_date('22-04-2004','DD-MM-YYYY'))
    and name = p_name;
    --preserve lock
    if l_checked_out_by is not null then
    update doclib_documents
    set checkedout_by = l_checked_out_by
    where doc_id = l_doc_id;
    end if;
    --do alerts
    do_alerts('D',p_doc_id, l_doc_id);
    --update tasks
    update doclib_tasks
    set doc_id = l_doc_id
    where doc_id = p_doc_id;
    commit;
    exception when others then
    raise_application_error(-20001,'Exception encountered updating document: '||sqlerrm);
    end update_document;
    procedure update_doc_attributes (
    p_doc_id in varchar2,
    p_user_name in varchar2,
    p_description in varchar2,
    p_attr1 in varchar2,
    p_attr2 in varchar2,
    p_attr3 in varchar2
    is
    begin
    if get_acl_id(p_user_name) < 2 then
    raise_application_error(-20001,'You are not authorized to update document attributes.');
    end if;
    update doclib_documents
    set description = p_description,
    attr1 = p_attr1,
    attr2 = p_attr2,
    attr3 = p_attr3
    where doc_id = p_doc_id;
    commit;
    exception when others then
    raise_application_error(-20001,'Exception encountered updating document attributes: '||sqlerrm);
    end update_doc_attributes;
    procedure checkout (
    p_doc_id in varchar2,
    p_user_name in varchar2
    is
    l_chkout_lst varchar2(32000);
    begin
    if get_acl_id(p_user_name) < 2 then
    --raise_application_error(-20001,'You are not authorized to checkout documents.');
    return_xml(p_doc_id,'CHECKOUT','You are not authorized to lock documents.',null,'FAILED',p_user_name);
    return;
    end if;
    --This can be the optimistic locking scheme
    if doc_is_checkedout_by(p_doc_id) is not null then
    --raise_application_error(-20001,'This document is already checked out.');
    return_xml(p_doc_id,'CHECKOUT','This document is already locked.',null,'FAILED',p_user_name);
    return;
    end if;
    update doclib_documents
    set checkedout_by = p_user_name
    where doc_id = p_doc_id;
    commit;
    l_chkout_lst := get_checkout_list(p_user_name);
    return_xml(p_doc_id,'CHECKOUT','Document successfully locked.',l_chkout_lst,'SUCCESS',p_user_name);
    exception when others then
    --raise_application_error(-20001,'Expection encountered checking out document: '||sqlerrm);
    return_xml(p_doc_id,'CHECKOUT','Expection encountered checking out document: '||sqlerrm,null,'FAILED',p_user_name);
    end checkout;
    procedure checkin (
    p_doc_id in varchar2,
    p_user_name in varchar2
    is
    begin
    if doc_is_checkedout_by(p_doc_id) is null then
    raise_application_error(-20001,'This document is not locked.');
    end if;
    update doclib_documents
    set checkedout_by = null
    where doc_id = p_doc_id;
    commit;
    exception when others then
    raise_application_error(-20001,'Exception encountered checking in document: '||sqlerrm);
    end checkin;
    procedure uncheckout (
    p_doc_id in varchar2,
    p_user_name in varchar2
    is
    l_checkedout_by varchar2(255);
    l_chkout_lst varchar2(32000);
    begin
    l_checkedout_by := doc_is_checkedout_by(p_doc_id);
    if l_checkedout_by is null then
    --raise_application_error(-20001,'This document is not checked out.');
    return_xml(p_doc_id,'UNCHECKOUT','This document is not locked.',null,'FAILED',p_user_name);
    return;
    end if;
    --This can be optimistic locking scheme
    if upper(l_checkedout_by) != upper(p_user_name) and get_acl_id(p_user_name) < 3 then
    --raise_application_error(-20001,'You are not authorized to uncheckout this document.');
    return_xml(p_doc_id,'UNCHECKOUT','You are not authorized to unlock this document.',null,'FAILED',p_user_name);
    return;
    end if;
    update doclib_documents
    set checkedout_by = null
    where doc_id = p_doc_id;
    commit;
    l_chkout_lst := get_checkout_list(p_user_name);
    return_xml(p_doc_id,'UNCHECKOUT','Unlock was successfull',l_chkout_lst,'SUCCESS',p_user_name);
    exception when others then
    --raise_application_error(-20001,'Exception encountered unchecking out document: '||sqlerrm);
    return_xml(p_doc_id,'UNCHECKOUT','Exception encountered unlocking document: '||sqlerrm,null,'FAILED',p_user_name);
    end uncheckout;
    procedure update_member (
    p_user_name in varchar2,
    p_member_id in varchar2,
    p_email in varchar2,
    p_acl_id in varchar2,
    p_retrieved in varchar2
    is
    l_retrieved date;
    begin
    l_retrieved := to_date(p_retrieved,'DD-MM-YYYY HH24:MI:SS');
    if get_acl_id(p_user_name) < 3 then
    raise_application_error(-20001,'You are not authorized to update members.');
    end if;
    --optimistic locking
    for c1 in (select null
    from doclib_members
    where user_id = p_member_id
    and updated_on > l_retrieved ) loop
    raise_application_error(-20001,'The member has been updated since you retrieved the data. Refresh and try again.');
    end loop;
    update doclib_members
    set email_address = p_email,
    role_id = p_acl_id
    where user_id = p_member_id;
    commit;
    exception when others then
    raise_application_error(-20001,'Exception encountered updating member: '||sqlerrm);
    end update_member;
    procedure update_member_email (
    p_user_name in varchar2,
    p_email in varchar2,
    p_retrieved in varchar2
    is
    l_user_id number;
    l_retrieved date;
    begin
    l_user_id := get_member_id(p_user_name);
    l_retrieved := to_date(p_retrieved,'DD-MM-YYYY HH24:MI:SS');
    --optimistic locking
    for c1 in (select null
    from doclib_members
    where user_id = l_user_id
    and updated_on > l_retrieved ) loop
    raise_application_error(-20001,'Remarkably, your email address changed since you retrieved the data. Refresh and try again.');
    end loop;
    update doclib_members
    set email_address = p_email
    where user_id = l_user_id;
    commit;
    exception when others then
    raise_application_error(-20001,'Exception encountered updating email: '||sqlerrm);
    end update_member_email;
    procedure update_task (
    p_task_id in varchar2,
    p_title in varchar2,
    p_user_name in varchar2,
    p_assigned in varchar2,
    p_priority in varchar2,
    p_status in varchar2,
    p_pct_complete in varchar2,
    p_description in varchar2,
    p_start_date in varchar2,
    p_due_date in varchar2,
    p_doc_id in varchar2,
    p_retrieved in varchar2
    is
    l_start_date date;
    l_due_date date;
    l_retrieved date;
    begin
    if get_acl_id(p_user_name) < 2 then
    raise_application_error(-20001,'You are not authorized to update tasks.');
    end if;
    l_retrieved := to_date(p_retrieved,'DD-MM-YYYY HH24:MI:SS');
    l_start_date := to_date(p_start_date,'DD-MM-YYYY HH24:MI');
    l_due_date := to_date(p_due_date, 'DD-MM-YYYY HH24:MI');
    --optimistic locking
    for c1 in (select null
    from doclib_tasks
    where task_id = p_task_id
    and updated_on > l_retrieved ) loop
    raise_application_error(-20001,'This task has been updated since you retrieved the data. Refresh and try again.');
    end loop;
    update doclib_tasks
    set assigned_to = p_assigned,
    priority_id = p_priority,
    status_id = p_status,
    pct_complete = p_pct_complete,
    name = p_title,
    description = p_description,
    start_date = l_start_date,
    due_date = l_due_date,
    doc_id = p_doc_id
    where task_id = p_task_id;
    do_alerts('T',p_task_id,null);
    commit;
    exception when others then
    raise_application_error(-20001,'Exception encountered updating task: '||sqlerrm);
    end update_task;
    procedure update_link (
    p_link_id in varchar2,
    p_user_name in varchar2,
    p_name in varchar2,
    p_url in varchar2,
    p_retrieved in varchar2
    is
    l_retrieved date;
    begin
    if get_acl_id(p_user_name) < 2 then
    raise_application_error(-20001,'You are not authorized to update links.');
    end if;
    l_retrieved := to_date(p_retrieved,'DD-MM-YYYY HH24:MI:SS');
    --optimistic locking
    for c1 in (select null
    from doclib_links
    where link_id = p_link_id
    and updated_on > l_retrieved ) loop
    raise_application_error(-20001,'This link has been updated since you retrieved the data. Refresh and try again.');
    end loop;
    update doclib_links
    set name = p_name,
    url = p_url
    where link_id = p_link_id;
    commit;
    exception when others then
    raise_application_error(-20001,'Exception encountered updating link: '||sqlerrm);
    end update_link;
    procedure update_announcement (
    p_an_id in varchar2,
    p_user_name in varchar2,
    p_title in varchar2,
    p_description in varchar2,
    p_expire_date in varchar2,
    p_retrieved in varchar2
    is
    l_expire_date date;
    l_retrieved date;
    begin
    if get_acl_id(p_user_name) < 2 then
    raise_application_error(-20001,'You are not authorized to update announcements.');
    end if;
    l_retrieved := to_date(p_retrieved,'DD-MM-YYYY HH24:MI:SS');
    l_expire_date := to_date(p_expire_date,'DD-MM-YYYY HH24:MI');
    --optimistic locking
    for c1 in (select null
    from doclib_announcements
    where an_id = p_an_id
    and updated_on > l_retrieved ) loop
    raise_application_error(-20001,'This task has been updated since you retrieved the data. Refresh and try again.');
    end loop;
    update doclib_announcements
    set title = p_title,
    description = p_description,
    expire_date = l_expire_date
    where an_id = p_an_id;
    commit;
    exception when others then
    raise_application_error(-20001,'Exception encountered updating announcement: '||sqlerrm);
    end update_announcement;
    procedure delete_document (
    p_doc_id in varchar2,
    p_user_name in varchar2,
    p_delete_all in varchar2 default null
    is
    l_date date := sysdate;
    l_checkedout_by varchar2(255);
    l_chkout_lst varchar2(32000);
    begin
    if get_acl_id(p_user_name) < 2 then
    --raise_application_error(-20001,'You are not authorized to delete documents.');
    return_xml(p_doc_id,'DELETE','You are not authorized to delete documents.',null,'FAILED',p_user_name);
    return;
    end if;
    l_checkedout_by := doc_is_checkedout_by(p_doc_id);
    if l_checkedout_by is not null and upper(l_checkedout_by) != upper(p_user_name) then
    --raise_application_error(-20001,'This document is currently checked out by '||l_checkedout_by);
    return_xml(p_doc_id,'DELETE','This document is currently locked by '||l_checkedout_by,null,'FAILED',p_user_name);
    return;
    end if;
    if p_delete_all = 'Y' then
    update doclib_documents
    set deleted_as_of = l_date
    where doc_id = p_doc_id
    or revision_of = p_doc_id;
    else
    update doclib_documents
    set deleted_as_of = l_date
    where doc_id = p_doc_id;
    end if;
    commit;
    l_chkout_lst := get_checkout_list(p_user_name);
    return_xml(p_doc_id,'DELETE','Document successfully deleted.',l_chkout_lst,'SUCCESS',p_user_name);
    exception when others then
    --raise_application_error(-20001,'Exception encountered deleting document: '||sqlerrm);
    return_xml(p_doc_id,'DELETE','Exception encountered deleting document: '||sqlerrm,null,'FAILED',p_user_name);
    end delete_document;
    procedure really_delete_document (
    p_user_name in varchar2,
    p_doc_id in varchar2
    is
    begin
    if get_acl_id(p_user_name) < 3 then
    raise_application_error(-20001,'You are not authorized to really delete documents.');
    end if;
    delete
    from doclib_documents
    where doc_id = p_doc_id;
    commit;
    exception when others then
    raise_application_error(-20001,'Exception encountered deleting document: '||sqlerrm);
    end really_delete_document;
    procedure delete_member (
    p_user_name in varchar2,
    p_user_id in varchar2
    is
    begin
    if get_acl_id(p_user_name) < 3 then
    raise_application_error(-20001,'You are not authorized to delete members.');
    end if;
    delete
    from doclib_members
    where user_id = p_user_id;
    commit;
    exception when others then
    raise_application_error(-20001,'Exception encountered deleting member: '||sqlerrm);
    end delete_member;
    procedure delete_task (
    p_user_name in varchar2,
    p_task_id in varchar2
    is
    begin
    if get_acl_id(p_user_name) < 2 then
    raise_application_error(-20001,'You are not authorized to delete tasks.');
    end if;
    delete
    from doclib_tasks
    where task_id = p_task_id;
    commit;
    exception when others then
    raise_application_error(-20001,'Exception encountered deleting task: '||sqlerrm);
    end delete_task;
    procedure delete_announcement (
    p_user_name in varchar2,
    p_an_id in varchar2
    is
    begin
    if get_acl_id(p_user_name) < 2 then
    raise_application_error(-20001,'You are not authorized to delete announcements.');
    end if;
    delete
    from doclib_announcements
    where an_id = p_an_id;
    commit;
    exception when others then
    raise_application_error(-20001,'Exception encountered deleting announcement: '||sqlerrm);
    end delete_announcement;
    procedure delete_link (
    p_user_name in varchar2,
    p_link_id in varchar2
    is
    begin
    if get_acl_id(p_user_name) < 2 then
    raise_application_error(-20001,'You are not authorized to delete links.');
    end if;
    delete
    from doclib_links
    where link_id = p_link_id;
    commit;
    exception when others then
    raise_application_error(-20001,'Exception encountered deleting link: '||sqlerrm);
    end delete_link;
    procedure make_doc_current (
    p_user_name in varchar2,
    p_name in varchar2,
    p_doc_id in varchar2
    is
    l_name varchar2(255);
    l_checkedout_by varchar2(255);
    l_curr_doc_id number;
    begin
    if get_acl_id(p_user_name) < 2 then
    raise_application_error(-20001,'You are not authorized to make this document current.');
    end if;
    l_checkedout_by := doc_is_checkedout_by(p_doc_id);
    if l_checkedout_by is not null and upper(l_checkedout_by) != upper(p_user_name) then
    raise_application_error(-20001,'This document is currently locked by '||l_checkedout_by);
    end if;
    for c1 in (select doc_id
    from doclib_documents
    where deleted_as_of = to_date('22-04-2004','DD-MM-YYYY')
    and revision_of = 0
    and name = p_name ) loop
    l_curr_doc_id := c1.doc_id;
    exit; -- this should only get one row, but just in case
    end loop;
    l_checkedout_by := doc_is_checkedout_by(l_curr_doc_id);
    if l_checkedout_by is not null and upper(l_checkedout_by) != upper(p_user_name) then
    raise_application_error(-20001,'This document is currently locked by '||l_checkedout_by);
    end if;
    update doclib_documents
    set revision_of = p_doc_id,
    checkedout_by = null --Revisions can't be locked
    where name = p_name
    and doc_id != p_doc_id;
    update doclib_documents
    set revision_of = 0,
    checkedout_by = l_checkedout_by --In case original document was locked by p_user_name
    where doc_id = p_doc_id;
    --do alerts
    do_alerts('D',l_curr_doc_id, p_doc_id);
    commit;
    exception when others then
    raise_application_error(-20001,'Exception encountered making document current: '||sqlerrm);
    end make_doc_current;
    procedure undelete_document (
    p_user_name in varchar2,
    p_doc_id in varchar2
    is
    begin
    if get_acl_id(p_user_name) < 3 then
    raise_application_error(-20001,'You are not authorized to undelete a document.');
    end if;
    update doclib_documents
    set deleted_as_of = to_date('22-04-2004','DD-MM-YYYY')
    where doc_id = p_doc_id;
    commit;
    exception when others then
    raise_application_error(-20001,'Exception encountered undeleting document: '||sqlerrm);
    end undelete_document;
    procedure send_invitation (
    p_user_name in varchar2,
    p_url in varchar2,
    p_email in varchar2,
    p_acl_id in varchar2,
    p_subject in varchar2,
    p_body in varchar2
    is
    l_body clob;
    l_role_name varchar2(30);
    l_from varchar2(255);
    begin
    for c1 in (select name
    from doclib_roles
    where role_id = p_acl_id ) loop
    l_role_name := c1.name;
    end loop;
    for c1 in (select email_address
    from doclib_members
    where user_name = p_user_name ) loop
    l_from := c1.email_address;
    end loop;
    l_body := g_html_email_header||chr(13)||'<p />'||p_body||chr(13);
    l_body := l_body ||chr(13)||'<p />'||p_user_name||' has granted you access to '||p_url||'.';
    l_body := l_body ||chr(13)||' Click the link to view the site. You have been granted access to the workspace with ';
    l_body := l_body ||chr(13)||'the role of: '||l_role_name||'.'||g_html_email_footer;
    apex_mail.send(
    p_to => p_email,
    p_from => l_from,
    p_body => to_clob(' '),
    p_body_html => l_body,
    p_subj => p_subject );
    end send_invitation;
    procedure delete_document_multi (
    p_doc_ids in varchar2,
    p_user_name in varchar2
    is
    l_date date := sysdate;
    l_checkedout_by varchar2(255);
    l_chkout_lst varchar2(32000);
    l_vc_arr2 apex_application_global.vc_arr2;
    l_doc_id number;
    l_curr_doc_id number;
    begin
    if get_acl_id(p_user_name) < 2 then
    --raise_application_error(-20001,'You are not authorized to delete documents.');
    return_xml(p_doc_ids,'DELETE_MULTI','You are not authorized to delete documents.',null,'FAILED',p_user_name);
    return;
    end if;
    l_vc_arr2 := apex_util.string_to_table(p_doc_ids,',');
    for c1 in (select revision_of
    from doclib_documents
    where doc_id = l_vc_arr2(1) ) loop
    l_curr_doc_id := c1.revision_of;
    end loop;
    for z in 1..l_vc_arr2.count loop
    l_checkedout_by := doc_is_checkedout_by(l_vc_arr2(z));
    if l_checkedout_by is not null and upper(l_checkedout_by) != upper(p_user_name) then
    --raise_application_error(-20001,'This document is currently checked out by '||l_checkedout_by);
    return_xml(l_vc_arr2(z),'DELETE_MULTI','This document is currently locked by '||l_checkedout_by,null,'FAILED',p_user_name);
    return;
    end if;
    update doclib_documents
    set deleted_as_of = l_date
    where doc_id = l_vc_arr2(z);
    end loop;
    commit;
    l_chkout_lst := get_checkout_list(p_user_name);
    return_xml(l_curr_doc_id,'DELETE_MULTI','Documents successfully deleted',l_chkout_lst,'SUCCESS',p_user_name);
    exception when others then
    --raise_application_error(-20001,'Exception encountered deleting document: '||sqlerrm);
    return_xml(p_doc_ids,'DELETE_MULTI','Exception encountered deleting documents '||sqlerrm,null,'FAILED',p_user_name);
    end delete_document_multi;
    procedure rollback_document (
    p_doc_id in varchar2,
    p_user_name in varchar2
    is
    l_date date := sysdate;
    l_checkedout_by varchar2(255);
    l_chkout_lst varchar2(32000);
    begin
    if get_acl_id(p_user_name) < 2 then
    return_xml(p_doc_id,'ROLLBACK','You are not authorized to rollback documents.',null,'FAILED',p_user_name);
    return;
    end if;
    l_checkedout_by := doc_is_checkedout_by(p_doc_id);
    --can be used as optimistic locking
    if l_checkedout_by is not null and upper(l_checkedout_by) != upper(p_user_name) then
    return_xml(p_doc_id,'ROLLBACK','This document is currently locked by '||l_checkedout_by,null,'FAILED',p_user_name);
    return;
    end if;
    update doclib_documents
    set deleted_as_of = l_date
    where doc_id = p_doc_id;
    for c1 in (select doc_id, name
    from doclib_documents
    where deleted_as_of = to_date('22-04-2004','DD-MM-YYYY')
    and revision_of = p_doc_id
    and version_no = (select max(version_no)
    from doclib_documents
    where deleted_as_of = to_date('22-04-2004','DD-MM-YYYY')
    and revision_of = p_doc_id) ) loop
    doclib.make_doc_current(
    p_user_name => p_user_name,
    p_name => c1.name,
    p_doc_id => c1.doc_id );
    apex_util.set_session_state('DOC_ID',c1.doc_id);
    end loop;
    commit;
    l_chkout_lst := get_checkout_list(p_user_name);
    return_xml(p_doc_id,'ROLLBACK','Document successfully rolled back',l_chkout_lst,'SUCCESS',p_user_name);
    exception when others then
    return_xml(p_doc_id,'ROLLBACK','Exception encountered rolling back document: '||sqlerrm,null,'FAILED',p_user_name);
    end rollback_document;
    /* Begin CBackstrom procedures and functions */
    PROCEDURE return_all_docs(p_doc_type IN VARCHAR2) IS
    l_checkedout_by VARCHAR2(4000);
    l_attr1 VARCHAR2(4000);
    l_attr2 VARCHAR2(4000);
    l_attr3 VARCHAR2(4000);
    BEGIN
    l_checkedout_by := v('P9_MEMBERS');
    l_attr1 := v('P9_ATTR1');
    l_attr2 := v('P9_ATTR2');
    l_attr3 := v('P9_ATTR3');
    IF(p_doc_type = 'XML') THEN
    owa_util.mime_header('text/xml', FALSE);
    htp.p('Cache-Control: no-cache');
    htp.p('Pragma: no-cache');
    owa_util.http_header_close;
    END IF;
    htp.p('<div id="filelist">');
    --htp.p('<div style="width:150px;"></div>');
    IF v('P9_DESC') IS NOT NULL THEN
    FOR c1 IN
    (SELECT score(1) sc,
    name,
    doc_id,
    checkedout_by,
    '<img src="' || decode(mime_type, 'application/vnd.oasis.opendocument.text', '' || v('APP_IMAGES') || 'icodt.GIF', 'application/vnd.ms-excel', '' || v('APP_IMAGES') || 'ICXLS.GIF', 'application/msword', '' || v('APP_IMAGES') || 'ICDOC.GIF', 'application/pdf', '' || v('APP_IMAGES') || 'icpdf.GIF', 'application/vnd.ms-powerpoint', '' || v('APP_IMAGES') || 'ICPPT.GIF', 'application/vnd.oasis.opendocument.spreadsheet', '' || v('APP_IMAGES') || 'iccalc.GIF', 'application/vnd.oasis.opendocument.presentation', '' || v('APP_IMAGES') || 'icodp.GIF', 'text/plain', '' || v('APP_IMAGES') || 'ICTXT.GIF', 'application/x-zip-compressed', '' || v('APP_IMAGES') || 'ICZIP.GIF', '' || v('APP_IMAGES') || 'ICGEN.GIF') || '" width="16" height="16" border="0" />' img
    FROM doclib_documents
    WHERE deleted_as_of = to_date('22-04-2004', 'DD-MM-YYYY')
    AND revision_of = 0
    AND(checkedout_by = l_checkedout_by OR l_checkedout_by = '0')
    AND(attr1 = l_attr1 OR l_attr1 = '0')
    AND(attr2 = l_attr2 OR l_attr2 = '0')
    AND(attr3 = l_attr3 OR l_attr3 = '0')
    AND contains(contents, doclib.parse_search_string(v('P9_DESC')), 1) > 0
    ORDER BY sc DESC)
    LOOP
    IF c1.checkedout_by IS NULL THEN
    htp.p('<a href="javascript:void(0) onclick="GetDoc(this,''' || c1.doc_id || ''')" id="' || c1.doc_id || '">' || c1.img || '  (' || c1.sc || ') '|| c1.name || '</a>');
    ELSIF c1.checkedout_by = apex_application.g_user THEN
    htp.p('<a href="javascript:void(0) onclick="GetDoc(this,''' || c1.doc_id || ''')" id="' || c1.doc_id || '" class="checkedoutme">' || c1.img || '  (' || c1.sc || ') ' || c1.name || '(' || c1.sc || ')</a>');
    ELSE
    htp.p('<a href="javascript:void(0) onclick="GetDoc(this,''' || c1.doc_id || ''')" id="' || c1.doc_id || '" class="checkedout">' || c1.img || '  (' || c1.sc || ') '|| c1.name || '(' || c1.sc || ')</a>');
    END IF;
    END LOOP;
    ELSE
    FOR c1 IN
    (SELECT name,
    doc_id,
    checkedout_by,
    '<img src="' ||decode(mime_type,'application/vnd.oasis.opendocument.text', ''|| v('APP_IMAGES')||
    'icodt.GIF','application/vnd.ms-excel',''||v('APP_IMAGES')||'ICXLS.GIF','application/msword',''||
    v('APP_IMAGES')||'ICDOC.GIF','application/pdf',''||v('APP_IMAGES')||'icpdf.GIF','application/vnd.ms-powerpoint',''||
    v('APP_IMAGES')||'ICPPT.GIF','application/vnd.oasis.opendocument.spreadsheet',''||v('APP_IMAGES')||
    'iccalc.GIF','application/vnd.oasis.opendocument.presentation',''||v('APP_IMAGES')||'icodp.GIF','text/plain',''||
    v('APP_IMAGES')||'ICTXT.GIF','application/x-zip-compressed',''||v('APP_IMAGES')||'ICZIP.GIF',''||v('APP_IMAGES')||
    'ICGEN.GIF')||'" width="16" height="16" border="0" />' img
    FROM doclib_documents
    WHERE deleted_as_of = to_date('22-04-2004', 'DD-MM-YYYY')
    AND revision_of = 0
    AND(checkedout_by = l_checkedout_by OR l_checkedout_by = '0')
    AND(attr1 = l_attr1 OR l_attr1 = '0')
    AND(attr2 = l_attr2 OR l_attr2 = '0')
    AND(attr3 = l_attr3 OR l_attr3 = '0')
    order by name, updated_on desc)
    LOOP
    IF c1.checkedout_by IS NULL THEN
    htp.p('<a href="javascript:void(0) onclick="GetDoc(this,''' || c1.doc_id || ''')" id="' || c1.doc_id || '">' || c1.img || '  ' || c1.name || '</a>');
    ELSIF c1.checkedout_by = apex_application.g_user THEN
    htp.p('<a href="javascript:void(0) onclick="GetDoc(this,''' || c1.doc_id || ''')" id="' || c1.doc_id || '" class="checkedoutme">' || c1.img || '  ' || c1.name || '</a>');
    ELSE
    htp.p('<a href="javascript:void(0) onclick="GetDoc(this,''' || c1.doc_id || ''')" id="' || c1.doc_id || '" class="checkedout">' || c1.img || '  ' || c1.name || '</a>');
    END if;
    END LOOP;
    END IF;
    htp.p('</div>');
    END;
    PROCEDURE doc_versions(p_doc_id IN VARCHAR2) IS
    l_checkedout_by VARCHAR2(4000);
    l_doc_name VARCHAR2(4000);
    BEGIN
    htp.p('<table id="doc_versions" cellpadding="0" border="0" cellspacing="0">');
    htp.p('<tr>');
    htp.p('<th><input type="checkbox" onclick="html_CheckAll(''doc_versions'',this.checked)" /></th>');
    htp.p('<th>Version</th>');
    htp.p('<th>Created</th>');
    htp.p('<th>Created By</th>');
    htp.p('</tr>');
    FOR c2 IN
    (SELECT doc_id,
    decode(revision_of,0,' ',apex_item.checkbox(1,doc_id)) a,
    name,
    version_no,
    created_on,
    created_by
    FROM doclib_documents
    WHERE deleted_as_of = to_date('22-04-2004', 'DD-MM-YYYY')
    AND(doc_id = p_doc_id OR revision_of = p_doc_id)
    ORDER BY version_no DESC)
    LOOP
    htp.p('<tr>');
    htp.p('<td>' || c2.a || '</td>');
    htp.p('<td><a id="filehref" href="apex_util.count_click?p_url=' || v('OWNER') || '.get_doc?p=' || c2.doc_id || '&p_cat=DOCS&p_id=' || c2.doc_id || '&p_user=' || v('APP_USER') || '&p_workspace=' || apex_custom_auth.get_security_group_id || '">' || c2.version_no || '</a></td>');
    htp.p('<td>' || to_char(c2.created_on, 'MM/DD/YYYY HH:MI AM') || '</td>');
    htp.p('<td>' || c2.created_by || '</td>');
    htp.p('</tr>');
    END LOOP;
    htp.p('</table>');
    END;
    FUNCTION doc_is_updated_by(p_doc_id IN VARCHAR2) RETURN VARCHAR2 IS
    BEGIN
    FOR c1 IN
    (SELECT updated_by
    FROM doclib_documents
    WHERE doc_id = p_doc_id)
    LOOP
    RETURN c1.updated_by;
    END LOOP;
    RETURN NULL;
    END doc_is_updated_by;
    FUNCTION doc_updated_date(p_doc_id IN VARCHAR2) RETURN VARCHAR2 IS
    BEGIN
    FOR c1 IN
    (SELECT to_char(updated_on, 'MM/DD/YYYY HH:MI AM') updated_on
    FROM doclib_documents
    WHERE doc_id = p_doc_id)
    LOOP
    RETURN c1.updated_on;
    END LOOP;
    RETURN NULL;
    END doc_updated_date;
    FUNCTION doc_created_date(p_doc_id IN VARCHAR2) RETURN VARCHAR2 IS
    BEGIN
    FOR c1 IN
    (SELECT to_char(created_on, 'MM/DD/YYYY HH:MI AM') created
    FROM doclib_documents
    WHERE doc_id = p_doc_id)
    LOOP
    RETURN c1.created;
    END LOOP;
    RETURN NULL;
    END doc_created_date;
    FUNCTION doc_linked_image(p_doc_id IN VARCHAR2) RETURN VARCHAR2 IS l_image_link VARCHAR2(4000);
    l_image_prefix VARCHAR2(4000);
    BEGIN
    l_image_link := '<a id="filehref" href="apex_util.count_click?p_url=' || v('OWNER') || '.get_doc?p=' || p_doc_id || '&p_cat=DOCS&p_id=' || p_doc_id || '&p_user=' || v('APP_USER') || '&p_workspace=' || apex_custom_auth.get_security_group_id || '">';
    l_image_prefix := v('APP_IMAGES');
    FOR c1 IN
    (SELECT mime_type,
    l_image_link || '<img src="' || decode(mime_type, 'application/vnd.oasis.opendocument.text', l_image_prefix || 'icodt.GIF', 'application/vnd.ms-excel', l_image_prefix || 'ICXLS.GIF', 'application/msword', l_image_prefix || 'ICDOC.GIF', 'application/pdf', l_image_prefix || 'icpdf.GIF', 'application/vnd.ms-powerpoint', l_image_prefix || 'ICPPT.GIF', 'application/vnd.oasis.opendocument.spreadsheet', l_image_prefix || 'iccalc.GIF', 'application/vnd.oasis.opendocument.presentation', l_image_prefix || 'icodp.GIF', 'text/plain', l_image_prefix || 'ICTXT.GIF', 'application/x-zip-compressed', l_image_prefix || 'ICZIP.GIF', l_image_prefix || 'ICGEN.GIF') || '" width="16" height="16" border="0" /></a>' image
    FROM doclib_documents
    WHERE doc_id = p_doc_id)
    LOOP
    RETURN c1.image;
    END LOOP;
    RETURN NULL;
    END doc_linked_image;
    FUNCTION doc_file_type(p_doc_id IN VARCHAR2) RETURN VARCHAR2 IS l_file_type VARCHAR2(4000);
    BEGIN
    FOR c1 IN
    (SELECT mime_type
    FROM doclib_documents
    WHERE doc_id = p_doc_id)
    LOOP
    RETURN c1.mime_type;
    END LOOP;
    RETURN NULL;
    END doc_file_type;
    PROCEDURE doc_attribute_tab(p_doc_id IN VARCHAR2, p_user_name IN VARCHAR2) IS
    BEGIN
    for c1 in (select attr1, attr2, attr3, description
    from doclib_documents
    where doc_id = p_doc_id ) loop
    htp.p('<table id="doc_attribute" cellpadding="0" cellspacing="0" border="0">');
    htp.p('<tr><th>'||v('DOC_WORKSPACE_LBL1')||'</th><td>'||APEX_ITEM.SELECT_LIST_FROM_LOV(1,c1.attr1,'ATTR1',null,'NO',null,null,'ATTR1')||'</td></tr>');
    htp.p('<tr><th>'||v('DOC_WORKSPACE_LBL2')||'</th><td>'||APEX_ITEM.SELECT_LIST_FROM_LOV(2,c1.attr2,'ATTR2',null,'NO',null,null,'ATTR2')||'</td></tr>');
    htp.p('<tr><th>'||v('DOC_WORKSPACE_LBL3')||'</th><td>'||APEX_ITEM.SELECT_LIST_FROM_LOV(3,c1.attr3,'ATTR3',null,'NO',null,null,'ATTR3')||'</td></tr>');
    htp.p('<tr><td colspan="2"><b>Description</b>
    <textarea id="desc">' || c1.description || '</textarea></td></tr>');
    htp.p('<tr><td colspan="2"><input type="button" onclick="doc_attribute_update()" value="Update Attributes" /></td></tr>');
    htp.p('</table>');
    end loop;
    END;
    PROCEDURE doc_detail(p_doc_id IN VARCHAR2, p_user_name IN VARCHAR2) IS
    l_checkedout_by VARCHAR2(4000);
    l_updated_by VARCHAR2(4000);
    l_created_date VARCHAR2(4000);
    l_updated_date VARCHAR2(4000);
    l_mime_type VARCHAR2(4000);
    l_doc_name VARCHAR2(4000);
    l_acl_id VARCHAR2(4000);
    BEGIN
    l_checkedout_by := doclib.doc_is_checkedout_by(p_doc_id);
    l_doc_name := doclib.get_doc_name(p_doc_id);
    l_acl_id := doclib.get_acl_id(p_user_name);
    l_updated_by := doc_is_updated_by(p_doc_id);
    l_mime_type := doc_file_type(p_doc_id);
    l_updated_date := doc_updated_date(p_doc_id);
    l_created_date := doc_created_date(p_doc_id);
    apex_util.set_session_state('DOC_ID', p_doc_id);
    apex_util.set_session_state('DOC_NAME', l_doc_name);
    htp.p('<div id="doc_detail">');
    htp.p('<div id="doc_header">');
    htp.p('<div id="doc_name"><a href="apex_util.count_click?p_url=' || v('OWNER') || '.get_doc?p=' || p_doc_id || '&p_cat=DOCS&p_id=' || p_doc_id || '&p_user=' || v('APP_USER') || '&p_workspace=' || apex_custom_auth.get_security_group_id || ">' || l_doc_name || '</a></div>');
    htp.p('<table><tr><td valign="top">');
    htp.p('<table>');
    htp.p('<tr><th>View :</th><td>' || doc_linked_image(p_doc_id) || '</td></tr>');
    htp.p('<tr><th>Locked By :</th><td id="checkedoutby">' || l_checkedout_by || '</td></tr>');
    htp.p('<tr><th>Modified By :</th><td id="modifiedby">' || l_updated_by || '</td></tr>');
    htp.p('</table>');
    htp.p('</td><td width="100">
    <td><td valign="top">');
    htp.p('<table>');
    htp.p('<tr><th>Updated Date :</th><td id="updateddate">' || l_updated_date || '</td></tr>');
    htp.p('<tr><th>Created Date :</th><td id="createddate">' || l_created_date || '</td></tr>');
    htp.p('<tr><th>Send Link :</th><td id="sendlink"><a href="mailto:' || doclib.get_member_email(p_user_name) || '?subject=' || l_doc_name || '&body=' || v('BASE_URL') || '/f?p=' || v('APP_ID') || ':2:::::P2_DOC_ID:' || p_doc_id || ">Click Here</a></td></tr>');
    htp.p('</table>');
    htp.p('</td></tr></table>');
    htp.p('</div>');
    htp.p('<div id="doc_actions">Actions : ');
    IF l_acl_id > 1 THEN
    IF l_checkedout_by IS NULL THEN
    htp.p('<a href="javascript:doc_Action(this,''' || p_doc_id || ''',''CHECKOUT'') id="checkout_button">Lock</a>');
    ELSIF l_checkedout_by = p_user_name OR l_acl_id > 2 THEN
    htp.p('<a href="javascript:doc_Action(this,''' || p_doc_id || ''',''UNCHECKOUT'') id="checkout_button">Unlock</a>');
    END IF;
    IF l_checkedout_by IS NULL OR l_checkedout_by = p_user_name THEN
    htp.p('Add Version');
    htp.p('Delete');
    END IF;
    -- htp.p('<a href="f?p=&APP_ID.:5:&SESSION.::::P5_NAME,P5_DOC_ID:' || l_doc_name || ',' || p_doc_id || ' id="versions_button">Versions</a>');
    END IF;
    htp.p('<a href="apex_util.count_click?p_url=' || v('OWNER') || '.get_doc?p=' || p_doc_id || '&p_cat=DOCS&p_id=' || p_doc_id || '&p_user=' || p_user_name || '&p_workspace=' || apex_custom_auth.get_security_group_id || ">View</a>');
    htp.p('<a href="f?p=' || v('APP_ID') || ':95:' || v('SESSION') || '::::P95_ALERT_TYPE,P95_ALERT_INTERVAL,P95_DOC_ID:D,,' || v('DOC_ID') || ">Alert Me</a>');
    htp.p('</div>');
    htp.p('<div id="action_message"></div>');
    htp.p('<div id="doc_tabs">');
    htp.p('<div id="doc_tabsbuttons">Versions<a id="tab3" href="javascript:void(0)" onclick="doc_Comments_Tab(''tab3'')">Comments</a>');
    if doclib.GET_ACL_ID(v('APP_USER')) > 1 then
    htp.p('Attributes');
    end if;
    htp.p('</div>');
    htp.p('<div id="doc_tabsbody">');
    htp.p('<div id="tab1_content">');
    doc_versions(p_doc_id);
    IF (l_checkedout_by IS NULL OR l_checkedout_by = p_user_name) and get_acl_id(v('APP_USER')) > 1 THEN
    htp.p('<hr /><input type="button" value="Delete All Versions" onclick="doc_Action(this,''' || p_doc_id || ''',''DELETE'')" />');
    if doc_has_revisions(p_doc_id) > 0 then
    htp.p('<input type="button" value="Delete Checked Versions" onclick="doc_Action(this,''' || p_doc_id || ''',''DELETE_CHECKED'')" />');
    htp.p('<input type="button" value="Delete Current Version (Rollback Version)" onclick="doc_Action(this,''' || p_doc_id || ''',''ROLLBACK'')" />');
    end if;
    END IF;
    htp.p('</div>');
    htp.p('<div id="tab2_content" style="display:none;">');
    doc_attribute_tab(p_doc_id, p_user_name);
    htp.p('</div>');
    htp.p('<div id="tab3_content" style="display:none;"><div id="doc_comments">
    </div></div>');
    htp.p('</div>');
    htp.p('</div>');
    htp.p('</div>');
    END;
    PROCEDURE doc_comments(p_doc_id IN VARCHAR2) IS
    BEGIN
    htp.p('<div>');
    htp.p('<table id="doc_versions" cellpadding="0" border="0" cellspacing="0">');
    htp.p('<tr><th>Member</th><th>Date</th><th>Comment</th></tr>');
    FOR c2 IN
    (SELECT description,
    created_by,
    created_on
    FROM doclib_documents
    WHERE(doc_id = p_doc_id OR revision_of = p_doc_id)
    AND(description IS NOT NULL OR description != '')
    AND deleted_as_of = to_date('22-04-2004','DD-MM-YYYY')
    ORDER BY created_on DESC)
    LOOP
    htp.p('<tr>' || '<td>' || c2.created_by || '</td><td>' || to_char(c2.created_on, 'MM/DD/YYYY HH:MI AM') || '</td><td>' || c2.description || '</td></tr>');
    END LOOP;
    htp.p('</table>');
    htp.p('</div>');
    END;
    /* End CBackstrom procedures and functions */
    end doclib;
    Error at line 1230: PL/SQL: SQL Statement ignored
    sync_index.sql
    declare
    l_job_id binary_integer;
    begin
    for c1 in (select job
    from user_jobs
    where what = 'ctx_ddl.sync_index(''doclib_docs_idx2'', ''2M'');' ) loop
    dbms_job.remove(c1.job);
    end loop;
    dbms_job.submit(
    job => l_job_id,
    what => 'ctx_ddl.sync_index(''doclib_docs_idx2'', ''2M'');',
    next_date => sysdate + 15/1440,
    interval => 'sysdate + 15/1440');
    end;
    ORA-06550: line 1, column 93:
    PLS-00201: identifier 'CTX_DDL.SYNC_INDEX' must be declared
    ORA-06550: line 1, column 93:
    PL/SQL: Statement ignored
    I would appreciate any suggestions.
    Thank you for your time.
    DanielD

  • Packaged App - Document Library - New user password?

    How do you set the password for a new user on the Document Library packaged app. The documentation suggests that by default it uses 'Standard application express authentication' which can then be changed. In which case the user admin function in the app does not work in its default state and would need to be removed if the user wants to use 'Standard application express authentication' (or does it?)
    Which leads me to another question:
    Is it possible to manage application express users from an application express app in Apex 3.0?
    Thanks
    Simon

    Simon:
    For a new user, you also need to create them as a normal Application Express authenticated user. To do that, click the Manage Application Express Users link under Administration from the Application Expres home page.
    The only thing the Document Library handles is authorization (who can do what). Authentication (who the heck are you) is determined by the application setting, which by default is standard Application Express authentication. So all you are doing in the Document Library on the user administration page, is defining who is a reader, contributor, or administrator. You are not actually creating users, you are just defining the rights for existing users.
    Regarding your second question, you can use the APEX_UTIL API to handle user management within your application. See:
    http://download-west.oracle.com/docs/cd/B32472_01/doc/appdev.300/b32471/api.htm#CHDBDCIE
    Specifically, CREATE_USER Procedure, EDIT_USER Procedure, CHANGE_CURRENT_USER_PW Procedure, etc.
    Regards,
    Jason

  • Using Designer to get Document ID in Document Library

    I am creating an approval workflow on a document library that auto starts on submitting a document.
    What I want to do, besides sending the user a link to view the document, is to actually provide a link to the URL that is used to generated the popup with approval options. I do not need a popup.  When you paste the URL popup in the address bar, you
    get the page with the correct info.
    Here's the URL:
    http://.../_Layouts/listform.aspx?PageType=4&ListId={...}&ID=22
    The number 22 is what I am trying to get.
    In Designer, when i do a look up, I cannot seem to get the ID of the document in the list view.

    Hi Ogrehulk,
    Is the URL the related document in the approval task?
    Do you want to put the URL in the email when user gets the task notification? 
    If yes, we can get the ID of the related document in the Start Approval Process step.
    Click Approval in the Start Approval Process step.
    Click Change the behavior of a single task under Customization.
    Navigate to the step Email task notification to Current Task:Assigned To in When a Task is Pending.
    Click Current Task:Assigned To.
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • Error while creating a new report data source in Sharepoint Document library

    I installed SSRS(sql server 2012 SP1) in my sharepoint 2013 farm(single server installation).
    I have installed SSRS addin for report also. 
    I created a document library and included the report data source content type, report builder report and report builder model content types. On click of any of these content types i get the below error. 
    "new Document requires a Microsoft SharePoint Foundation-compatible application and web browser. To add document to document library, click on the 'Upload' button."
    I am using windows 7 64-bit operation system with Google chrome and IE 8 64 bit.
    Any help would be appreciated. 

    Rakesh, is this an SSRS question?
    This doesn't look like Power View.
    Thanks!
    Ed Price, Azure & Power BI Customer Program Manager (Blog,
    Small Basic,
    Wiki Ninjas,
    Wiki)
    Answer an interesting question?
    Create a wiki article about it!

  • Looking for help with PowerShell script to delete folders in a Document Library

    I'd like to create a PowerShell script to delete old folders in a Document library that are over 30 days old. Has anyone created something like this?
    Orange County District Attorney

    Hello Sid:
    I am trying to do the same and Iam running the script to delete the subfolders inside a folder  but I have some errors. 
    Could you please take a look?
    _______Script________
    $web = Get-SPWeb -Identity https://myportal.mydomain.com
    $list = $web.GetList("ar_mailingactivity")
    $query =  New-Object Microsoft.SharePoint.SPQuery 
    $camlQuery = '<Where><And><Eq><FieldRef Name="ContentType" /><Value Type="Computed">Folder</Value></Eq><Leq><FieldRef Name="Created" /><Value Type="DateTime"><Today OffsetDays="-30" /></Value></Leq></And></Where>'
    $query.Query = $camlQuery
    $items = $list.GetItems($query)
    for ($intIndex = $items.Count - 1; $intIndex -gt -1; $intIndex--)
       $items.Delete($intIndex);
    ________Errors_______
    Unable to index into an object of type System.Management.Automation.PSMethod.
    At C:\Script.ps1:2 char:22
    + $list =$webGetList <<<< "ar_mailingactivity"]
    + CategoryInfo
    :InvalidOperation: (ar_mailingactivity:String) [], RuntimeException
    + FullyQualifiedErrorID
    :CannotIndex
    You cannot call a method on  a null-valued expression.
    At c:\Script.ps1:6 char:24
    + $items = $list.GetItems <<<< ($query)
    + CategoryInfo
    :InvalidOperation: (GetItems:String) [], RuntimeException
    + FullyQualifiedErrorID
    :InvokeMethodOnNull

  • How to read excel file in document library and store excel content in sql table

    Hello,
    Can anyone help me how to read the excel file present in document library and store the content inside excel into sql table?
    Please let me know the ways to acheive this. Feel free to give your suggestions.
    Thanks,
    Cool Developer

    Hi!
    this code i have written becuase i donot find any soltions on net for this , u can try with this . :)
    System.Data.OleDb.
    OleDbConnection ExcelConnection = null;
    FileMode fileMode;
    string filePath = ConfigurationManager.AppSettings["TempLoaction"] + "\\" + fileName;
    using (SPSite _site = new SPSite(SPContext.Current.Web.Url))
    using (SPWeb _web = _site.OpenWeb())
    string docLibrary = ConfigurationManager.AppSettings["DocumentLibrary"];
    SPFile _file = _web.GetFile("/" + docLibrary + "/" + fileName);
    fileMode =
    FileMode.Create;
    byte[] byteArray = _file.OpenBinary();
    MemoryStream dataStream = new MemoryStream(byteArray);
    Stream stream = dataStream;
    using (FileStream fs = File.Open(filePath, fileMode))
    byte[] buffer = new byte[4096];
    int bytesRead;
    while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) != 0)
    fs.Write(buffer, 0, bytesRead);
    fs.Close();
    //Create the Connection String
    try
    string ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;
    Data Source ='"
    + filePath + "'; Extended Properties=Excel 5.0";
    //Create the connection
    ExcelConnection =
    new System.Data.OleDb.OleDbConnection(ConnectionString);
    //create a string for the query
    string ExcelQuery;
    //Sheet1 is the sheet name
    //create the query:
    //read columns from the Excel file
    ExcelQuery =
    "Select * from [Sheet1$]"; // from Sheet1";
    //use "Select * ... " to select the entire sheet
    //create the command
    System.Data.OleDb.
    OleDbCommand ExcelCommand = new System.Data.OleDb.OleDbCommand(ExcelQuery, ExcelConnection);
    //Open the connection
    ExcelConnection.Open();
    //Create a reader
    System.Data.OleDb.
    OleDbDataReader ExcelReader;
    ExcelReader = ExcelCommand.ExecuteReader();
    //For each row after the first
    while (ExcelReader.Read())
    thanks,
    kshitij

  • How do I show/refresh data from an Access Web App in an Excel spreadsheet saved in a Document Library on Sharepoint 2013 online

    I have an Access 2013 Web App in my Sharepoint 2013 online website. It contains a query to report on its data (several, actually, but let's keep it simple). I want to connect an Excel spreadsheet to the query, visualise the data in pivot tables/graphs/whatever,
    save the spreadsheet in a Document Library, and let other team site Sharepoint users open the spreadsheet (preferably in Excel online, but with Excel client if it has to be) and see/copy the data, refreshed with the latest information from the Access Web App.
    Simple, surely!
    The way I'm doing it at the moment is to create an ODC file to connect to the cloud-based Access 2013 database, save that ODC in a Data Connection Library in the SP site, and use the saved ODC file as data source in the Excel spreadsheet. This works and
    successfully keeps everything 'in the cloud' but I can't get it to refresh in Excel Online, and if I open the spreadsheet in Excel Client I have to enter the database password every time to refresh it. I don't really want to issue this password to everyone
    who might want to view the data. There must be a better way than this ODC method, I suspect.
    Googlings on this have led down various blind alleys - Excel Services, PowerPivots, Web Parts - but I'm stuck on which to follow through. Please, someone, point me to an article/book/website that explains how to do this step-by-step in simple language..
    thanks
    Jonathan

    I don't see any quick way of achieving it - at least there's no such functionality exists in SharePoint. All you can do, develop an event receiver that will update the fields in the list item once the excel file is added/updated. You can use OpenXml API
    to manipulate the excel file.
    Thanks,
    Sohel Rana
    http://ranaictiu-technicalblog.blogspot.com

  • Prompting the credentials while click MS office documents in document library in SharePoint Foundation 2010

    Hi,
    I have site with contains many document library each contains many MS Office and Pdf files. We have provided document library level access rights. While users click the file name, "Prompting the credentials while click MS office documents in document
    library in SharePoint Foundation 2010".
    Its annoying the user.
    How could i resolve this? Its for all users.
    Note: only for MS Office file. other files are opening correctly.
    Kind Regards
    Poomani Sankaran

    Hi,
    According to your post, my understanding is that you got the promote issue when clicked the documents in the library of the SharePoint foundation server.
    The issue may be caused that the Kerberos authentication is misconfigured, you can change to NTLM to check whether it works.
    http://www.techrepublic.com/blog/smb-technologist/prevent-unwanted-credentials-prompts-with-sharepoint-document-libraries/
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • How the files are decreasing from RBS storage after some time i delete docs from document library, where shld I check the settings for this?

    HI
    I created a web application and configured  rbs storage ,
    I uploaded documents (for ex: 18 number)
     after uploaded  documents ,  and observed the RBS storage folder, number of files are increasing (39 number) , its working fine
    and also  I run the querys to check the rows increasing or not , (when I upload new doc rows are increased its fine also)
    select count(*) from alldocs
    Select count(*) from AllDocstreams
    but when I delete some docs from document library ,
    1)the doc itself deleted from document library
    2)when I check the rbs storage  there is no number of files are decreased(its still 39 files ), its same as  before doc deleted from doc library
    after some time I found the number of files are decreasing from RBS storage folder in sql server,
    here I want to know the how the files are decreasing from RBS storage  after some time, where  shld I check the settings for this? and how I control on it
    here how I know the settings for cleaning up orphan BLBOS how  these deleted BLOB
    adil

    1. WHen you delete the file from Sharepoint, it is still present in Recycle bin. This is a default setting in sharepoint for 30 days. Once files are deleted fro Recycle bin, it can also be delete from RBS
    2. There is a RBS cleanup job which deletes files from RBS. for more info check 
    http://mehuljamod.blogspot.in/2012/09/remote-blob-storage-maintainer-rbs.html

  • The Create List Item workflow action does not work in document library with document template

    My end goal is more complex but below is a basic example of the issue I’m having that just simply does not work.
    I'm trying to use a site workflow to create an item in a document library that has a document template applied to it but the file that gets created by the workflow is corrupt and cannot be opened.
    I created a document library and edited the document template by adding some text to the header and changing it to a Word docx file instead of a Word dotx file. I tested the document template by clicking the files tab in the ribbon and then clicking new
    document which opens the document template in Word and allows me to edit and save the document back to SharePoint. Then I created a SharePoint 2013 site workflow in SharePoint Designer that contains a single Create List Item action, and that action creates
    an item in the document library with the name field statically defined. I published the workflow and then manually start it on the site. The workflow completes successfully and when I navigate to the document library the document has been created by the workflow.
    When I click on the document to open it in the Word Web App it throws the error pictured below and if I open it in the Word client application it just opens a blank document and not the correct document template.
    I also tried using a SharePoint 2010 workflow with pretty much the same results. Opening the document in Word Web App gives the same error as above and opening the document in the Word client application gives the error pictured below.
    Come on Microsoft creating a Word Document in a SharePoint Document Library from a SharePoint Workflow should just work! Is this a bug or does anyone have any ideas on what is causing the this issue?

    I had the same problem with corrupted document - this worked for me:
    1. Create a 2010 Workflow which creates the list element in a document library
    (you may start this workflow from your 2013 workflow if applicable)
    2. In the Create New List Item properties - make sure to set ContentTypeId to your content type
    ("Id for indholdstype" is Danish for "Contenttype ID")
    3. Your Content Type template should be a ".docx" file - NOT a ".dotx" file...!
    (I have always created my templates for content types as .dotx files - seems Microsoft wants us to use ordinary .docx files as template files for content types)
    Hope this helps you!

  • How to open and read Excel Sheet from SharePoint 2013 Document Library using C# Visual Studio 2012

    Hi,
    To achieve these are the steps that I had followed :
    1. Add the document Library path into Central Admin -> Application Mgmt -> Manage Service App -> Excel Service App -> Trusted File Locations
    2. Add Documnet Library link to Trusted Connection Proivder
    3. Open Visual Studio as Run as Administrator
    4.Create an SharePoint 2013 Empty Project.
    5.Add Service Reference : http:\\<server>\_vti_bin/excelservice.asmx
    6.Service added successfully
    7.Create a class file and add the Service Reference namespace
    There is no such class as ExcelService to call. 
    Please let me know if somebody knows how to open the Excel file into C#(2012)  either using ExcelService or any other way to open. I tried old methods of Sharepoint 2010 server but it's not able to access classes.
    Requirement is :
    Need to read the excel sheet  from Document Library and transfer all data into DataTable.
    Please help asap. 

    Hi,
    This is the forum to discuss questions and feedback for Microsoft Office, I'll move your question to the SharePoint 2013 development forum
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/home?forum=sharepointdevelopment
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    George Zhao
    TechNet Community Support

  • The way SharePoint open office documents will differ if the user try to open them from the document library directly, or if users try to open the document from the search result page.

    I have a document library where I have uploaded an excel sheet to it. Now If I click on the excel sheet directly from the document library page , I will get the following error ““The webpage cannot be displayed””. While if I do a search and I open the excel
    sheet from the search result page , it will open the excel sheet using the excel services inside the browser !!.
    So can anyone advice on this ?
    Also if I have a PowerPoint document , and I try to open it from the document library I will get the following error “The webpage cannot be displayed” , and the URL will be prefix with the following “ms-powerpoint:ofv|u|”. while if i do a search and i open
    the PowerPoint from the search result page i will be prompted to either open or save the document ? So why SharePoint is reacting totally different when trying to open document library items from the document library Or from the search result page?

    Hi,
    The behavior in the document library could be probably because of the Documents handling setting. Please try setting it to default behavior (Open in browser) as i hear from you that the default behavior is to open from browser.
    Thanks, Suneetha
    Currently I have set the following;-
    1. On the library advance setting :- I define  “Open in the client application”
    2. On the web application setting:- I define stricked for Browser File Handling
    And I have noted if I delete the browser cache and I access the document , then I will be prompted with the download dialog. but if I re-click on the same document I will be redirected to the
    The webpage cannot be displayed
    And the ms-powerpoint:ofv|u| will be added to the beginning of the URL. So could this be a caching problem ?

  • Unable to load Packaged App Document Library 0.91 in Apex 3

    I have downloaded packaged application Document Library 0.91 from packaged applications URL and trying to import it into APEX 3.0.
    In Application Builder I am getting an error message that 'Script has exceeded the maximum limit'. So I tried executing the install script as a application parsing schema, then it returned following error in SQL*Plus:
    SQL> spool doclib_install.log
    SQL> @doc_library_installer_0.91.sql
    APPLICATION 12487 - Document Library 0.9
    Set Credentials...
    Illegal security group id value for this schema.
    Check Compatibility...
    API Last Extended:20070108
    Your Current Version:20070108
    This import is compatible with version: 20060224
    COMPATIBLE (You should be able to run this import without issues.)
    Set Application ID...
    begin
    ERROR at line 1:
    ORA-20001: Package variable g_security_group_id must be set.
    ORA-06512: at "FLOWS_030000.WWV_FLOW_API", line 45
    ORA-06512: at "FLOWS_030000.WWV_FLOW_API", line 237
    ORA-06512: at line 4
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.4.2 - Production
    With the Partitioning, OLAP and Data Mining options
    Am i missing anything or if anybody got a luck to install this app into Apex 3.0 pls. let me know how to resolve the above error?
    Thanks & regards,
    Preet

    Preet,
    Maybe we need to be more explicit in the readme. You need to "Import and install the doc_library_installer_0.91.sql ... Select to install supporting objects." This is from the Application Builder, select Import. Maybe you uploaded it as a script under the SQL Workshop? Those directions are in the readme for upgrading from the .9 version to the .91 version without losing your data.
    -- Sharon

  • Not able to copying files/folders from one Document Library to another Document Library using Open with Browser functionality

    Hi All, 
    We have SharePoint Production server 2013 where users are complaining that they are not able to copy or move files from one document library to another document library using “Open with Explorer” functionality.
    We tried to activate publishing features on production server but it did not work. We users reported following errors:  
    Copying files from one document library to another document library:
    Tried to map the document libraries and still not get the error to copy files: 
    In our UAT environment we are able to copy and move folders from using “Open with Explorer” though.
    We have tried to simulate in the UAT environment but could not reproduce the production environment.  
    Any pointers about this issue would be highly appertained.
    Thanks in advance
    Regards,
    Aroh  
    Aroh Shukla

    Hi John and all,
    One the newly created web applications that we created few days back and navigated to document library, clicked on “Open with Explorer”, we get this error.
    We're having a problem opening this location in file explorer. Add this website to your trusted and try again.
    We added to the trusted site in Internet Explorer for this web application, cleared the cache and open the site with same document library but still get the same above error.
    However, another existing web application (In same the Farm) that we are troubleshooting at the moment, we are able click on “Open with Explorer”,  login in credentials opens and we entered the details we are able to open the document
    library and tried to follow these steps:
    From Windows Explorer (using with Open with Explorer), tried to copy or move a files to
    source document library.
    From Windows Explorer moved this file to another destination document library and we got this error.
    What we have to achieve is users should be able to copy files and folders using
    Open with Explorer functionality. We don’t know why Open with Explorer
    functionality not work working for our environment.  
    Are we doing something wrong? 
    We have referred to following websites.
    we hope concepts of copying / Moving files are similar as SharePoint 2010. Our production environment is SharePoint 2013.   
    http://www.mcstech.net/blog/index.cfm/2012/1/4/SharePoint-2010-Moving-Documents-Between-Libraries https://andreakalli.wordpress.com/2014/01/28/moving-or-copying-files-and-folders-in-sharepoint/
    Please advise us. Thank you.
    Regards,
    Aroh
    Aroh Shukla

Maybe you are looking for

  • CIF interface: Error transfering material plant

    Hello Experts, I am traying to transfer a material plant across CIF interface. The problem is, when I activate the integration model, it fails. The error message is exactly this: "Location does not exist for external location 1790 , type 1040, and BS

  • Photos disappeared off computer and external hard drive

    I'm stumped. This morning I opened iPhoto (8.1.2) and got an error message that the library needed to be rebuilt. When I clicked ok I got a second error message that the files were corrupt and iPhoto closed. After some reading, I saved my library and

  • Integrating Silver light ISlands to Webdynpro ABAP Applications

    Hi Experts, In my project I want to enhance the UI of my application by using Silver Light Islands. I found that it is possible in Webdynpro ABAP . The following link i have seen ... http://help.sap.com/saphelp_nwpi71/helpdata/en/ba/b89348d6eb49eb8ff

  • SAP-BW  text table,hierarchy

    why we need text table in sap bw.Explian about hierarchy table in sap-bw

  • Unable to access/modify wifi after Mavericks installation on MacBook Pro

    I've just installed Mavericks OS X on my 2011 MacBook Pro. Although quite slow, everything seemed to go smoothly during the installation process. Once booted up in the new OS, I noticed immediately that I had no wifi connection on the device. I am un