Anexar xml no Outlook

Dicas do Oracle Forms Builder - Blocos, Itens, LOV, Canvas, Triggers, comandos, PLL, d2kwutil, FMB, Alert, menus, etc
Responder
diegorp
Rank: Programador Sênior
Rank: Programador Sênior
Mensagens: 49
Registrado em: Seg, 23 Mar 2009 10:44 am
Localização: Sapiranga - RS

Boa Tarde, tenho um comando que abre o Outlook e anexa um pdf, até ai sempre funcionou, agora preciso anexar um arquivo xml, estou fazendo do mesmo jeito que faço pra anexar o pdf passo o caminho e nome do pdf "c:\temp\meu_pdf.pdf", mas com o arquivo xml esta dando erro ORA - 305500, estou usando forms 6i banco XE e W7, alguém já passou por esse erro? Segue a baixo o comando que uso para abrir o outlook com o pdf anexado.

Selecionar tudo

declare
	--
	objOutlook       OLE2.OBJ_TYPE;
	objarg           OLE2.OBJ_TYPE;
	objMail          OLE2.OBJ_TYPE;
	OLEPARAM         OLE2.OBJ_TYPE;
	Attachment       OLE2.OBJ_TYPE;
	Attachment_dummy OLE2.OBJ_TYPE;
	MailItem         OLE2.OBJ_TYPE;
	Attch            OLE2.OBJ_TYPE;
	msg_attch        OLE2.OBJ_TYPE;
	args             OLE2.OBJ_TYPE;
	--
	r_cliente pessoa%rowtype;
	v_nome_pdf   varchar2(200);
	v_nome_xml   varchar2(500);
	r_parametro_sistema  parametro_sistema%rowtype;
	r_parametro_sistema1 parametro_sistema%rowtype;
	r_empresa pessoa%rowtype;
	--
begin
	--
	r_cliente := pc_corporativo.fn_cliente(:nota_saida.id_cliente);
	r_empresa := pc_corporativo.fn_empresa(:nota_saida.id_empresa);
	--
	if r_cliente.email is null then
		--
		pr_msg_alert('Não há e-mail cadastrado para o cliente '||:nota_saida.ds_id_cliente||'.','E',TRUE);
		--
	end if;
	--
	r_parametro_sistema := pc_administrador.fn_parametro_sistema('CAMINHO_PDF_NOTA_SAIDA',:nota_saida.id_empresa);
	--
	if r_parametro_sistema.valor_string is null then
		--
		pr_msg_alert('Parâmetro CAMINHO_PDF_NOTA_SAIDA não cadastrado.');
		--
	end if;
	--
	v_nome_pdf := r_parametro_sistema.valor_string||:nota_saida.nr_nota||'.pdf';
	v_nome_xml := fn_procura_xml;
	--
	-- Abre o outlook
	--
	objOutlook := OLE2.CREATE_OBJ('Outlook.Application');
  objarg     := OLE2.CREATE_ARGLIST;
  OLE2.ADD_ARG(objarg,0);
  objMail    := OLE2.INVOKE_OBJ(objOutlook,'CreateItem',objarg);
  OLE2.DESTROY_ARGLIST(objarg);

  OLE2.SET_PROPERTY(objmail,'To',r_cliente.email); -- e-mail destino
  OLE2.SET_PROPERTY(objmail,'Subject',r_empresa.razao_social||' - Nota Fiscal Nº '||:nota_saida.nr_nota); -- assunto do e-mail
  --OLE2.SET_PROPERTY(objmail,'Body','teste');
  -------------------
  -- Inicio Anexos --
  -------------------
  Attachment := OLE2.GET_OBJ_PROPERTY(objMail,'Attachments');
  OLEPARAM   := OLE2.CREATE_ARGLIST;
  OLE2.ADD_ARG(OLEPARAM,v_nome_pdf);
  Attachment_dummy := OLE2.INVOKE_OBJ(Attachment,'add',OLEPARAM);
  OLE2.DESTROY_ARGLIST(OLEPARAM);
  --
  --OLE2.INVOKE(objmail,'Send'); -- envia o e-mail direto, sem abrir o outlook
  OLE2.INVOKE(objmail,'Display'); -- abre o outlook na tela
  OLE2.RELEASE_OBJ(objmail);
  OLE2.RELEASE_OBJ(objOutlook);
	--
end;
Avatar do usuário
dr_gori
Moderador
Moderador
Mensagens: 5024
Registrado em: Seg, 03 Mai 2004 3:08 pm
Localização: Portland, OR USA
Contato:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

O erro ORA 305500 é bem genérico:
ORA 305500 - Generic Error From the OLE2 package.
Common Causes:
--------------
This error is commonly caused by a call to OLE2.RELEASE_OBJ and other similar calls when the full argument list to the procedure or function has not been specified.
No metalink tem um paper que talvez possa ajudar:
ORA-305500 With Webutil Client_OLE2.invoke_obj . (Doc ID 444371.1)

APPLIES TO:
Oracle Forms - Version: 9.0 to 10.1.2.3.0 - Release: 9 to 10.1.2.3
Oracle Solaris on SPARC (32-bit)
Checked for relevance on 30-Sep-2010

SYMPTOMS
When executing the WebUtil function "Client_OLE2.invoke_obj", an error message "ORA-305500 NON-ORACLE EXCEPTION" is displayed.

CAUSE
Microsoft changed some of the OLE calling interface between releases of the MS Office products.
Newer releases no longer support the "invoke_obj" function.

SOLUTION
To implement the solution, please execute the following steps:
1. change :
client_ole2.INVOKE_OBJ(vworkbooks,'Open',args);
to
client_OLE2.GET_OBJ_PROPERTY(vworkbooks,'Open',args);

In newer releases of MS Office products, Microsoft prescribes using "Get_obj_property" rather than "Invoke_obj".
Responder
  • Informação
  • Quem está online

    Usuários navegando neste fórum: Nenhum usuário registrado e 9 visitantes