栏目搜索
 
 
 
 
你的位置:首页 > LOTUS > 如何用 C API 删除附件 >
 

如何用 C API 删除附件

发布者:[本站编辑] | 来源:[]

如何用 C API 删除附件_电脑维修资料库

problem:how can an attachment be deleted using the notesapi?solution:the function nsfnotedetachfile deletes an attached file item from a note and also deallocates the disk space used to store the attached file in the database. it will not remove a bitmap or icon representation of the file store in a composite. the blockid of the item is a required parameter of nsfnotedetachfile which is used to reference the attachment you wish to delete. the blockid of the item can be obtained by passing the item name ($file) to the function nsfiteminfo. please note the function nsfiteminfo contains two blockid's. the fourth parameter is the item blockid which should be passed to nsfnotedetachfile. the sixth parameter contains the pool and block of the item's value. if the note contains more then one attachment and therefore more then one $file fields, use the function nsfiteminfo once with subsequent calls to nsfiteminfonext to iterate through the attachments. the deletetheattachment function is a code segment that will demonstrate how to delete a file attachment from a note. this function requires the noteid and dbhandle. the sample viewids which ships with the notesapi demonstrates how to obtain the noteid and dbhandle and can be used as a test driver for this function. the people view of the names.nsf usually contains (userid) attachments if you have registered a new person on the server. this application can be used to delete those attachments to free up space.status deletetheattachment(dbhandle hdb,noteid noteid){notehandle hnote;status error;char itemname<> = $file; blockid itemblockid, valueblockid;word wdatatype;dword dwlength; /* open the note. */if (error = nsfnoteopen (hdb, noteid, 0, &hnote)) return (err(error));/* get the item blockid of the $file. */ if (error = nsfiteminfo(hnote,itemname,(word)strlen(itemname),&itemblockid,&wdatatype,&valueblockid,&dwlength)){nsfnoteclose(hnote); return (err(error));} /* delete the attachment */if (error = nsfnotedetachfile(hnote, itemblockid)){nsfnoteclose(hnote); return (err(error));}/* save the new document */if (error = nsfnoteupdate (hnote, 0)){ nsfnoteclose (hnote);return (err(error));}/* close the note. */if (error = nsfnoteclose (hnote))return (err(error));/* end of subroutine. */return (noerror);}</t

 
返回列表 返回LOTUS
 
  推荐文章
 
     暂无
 
 
  随机资讯
 
     暂无