Detaching Attachments from a Notes Database Automatically

0
August 16, 2011

I need an automated way to extract attachments (Word docs, PDF, PowerPoints, etcetera) from a Notes Database and put them into a local folder (C:\Attachments for example).

I can manually open the database and detach each attachment one by one, but this takes a long time and I need this to be done on a scheduled basis. The database will continue to be used and the attachments need to be updated regularly (once a day).

I am new to working with Notes, so please provide step by step instructions. From reading a little it seems there must be a way to use LotusScript to do this, but I am not sure where to begin to even start LotusScript. (How does one start a new LotusScript agent? How can I get it to run once a day? Etcetera.) Thanks.

Comments See all(0)

Add comment
0
August 16, 2011

You have to use a scheduled agent to do this for you. You can write an agent with the following code. Just put this code in an agent and schedule it to run on hourly basis. Make is run on "New and modified documents since last run".

You can see this thread for a code example.

http:/Q_20844678.html

0
August 16, 2011

See the accpeted answer code in the thread. That's a good code. You can easily adapt it to suit your needs, if any required. If you have any doubts, feel free to ask.

0
August 16, 2011

Step by step.. hmmmm. let me try :)

(1) Open designer

(2) Go to agents view

(3) Click new agent button at the top left

(4) Give a name to the agent

(5) Click shared agent

(6) Change the setting "When shoukd this agent run" to -- On schdule daily

(7) Click schedule and specify a time. Avoid using time between 1-4 a.m.

(8) Change the setting "Which document(s) should it act on" to -- All new and modified documents since last run

(9) In the lower pane (Actions), select lotus script.

(10) Paste the code from the accepted answer in the linked thread.

(11) Customize the agent as per your needs. Its less or more okay. You might not need a change other than the folder path where attchemnts should be kept after being detached etc

(12) Save the agent and come out

The server will run this agent daily now and your attchemnts will get detached on a daily basis.

0
August 16, 2011

Sandbox on notes.net has a utility which can be used to detach automatically and create a link to it on the file system..

I think this is the link ... (site is down now, validate it later)

http://www-10.lotus.com/ld d/sandbox. nsf/ ecc552 f1ab6e46e4 852568a900 55c4cd/ fe7 542cd3b120 e1b00256c3 8004a6a27? OpenDocume nt

~Hemanth

0
August 16, 2011

Thanks Ranjeet,

That looks like what I need.

Can you tell me how I would delete the contents of the folder prior to detaching all the documents into it? (The folder needs to be in sync - if attachments are removed from the database they must be removed from the folder also).

You mentioned that I should avoid between 1-4 a.m. Why? This seems like the ideal time to do it actually...

Also, if there are two attachments in separate documents with the same name, will this code create two different files or will one overwrite the other? Based on my interpreration of the code, it looks like it's going to name it using like this: PATH\FILENAME(NOTEID).EXT - if so, then that's great.

Finally, how does Notes handle thread priority? Will the server be really sluggish while this is running?

Hemanth, the code at the sandbox was not for email, and not quite right for what I need to do.

0
August 16, 2011

Oops - I meant that the code at the sandbox WAS for email specifically - I need something that works generically and does not change the database - just creates the folder. I think Ranjeet is almost there.

0
August 16, 2011

>> Can you tell me how I would delete the contents of the folder prior to detaching all the documents into it? (The folder needs to be in sync - if attachments are removed from the database they must be removed from the folder also).

No, the current code doesn't handle the case. That needs to be coded. And that depends a lot on the volume of data. Attachments from a database that can be in dozens at a time need to be handled differently than a database that may contain 1000s of attachments at a time. Pls specify your requirement in detail and I might be able to help.

Though a very clever trick can be that -- do your house keeping simultaneously. Store your attachment as soon as document is created in database (An agent can be trigerred to run on NEW and MODFIED since ....). Also, you may write a database level handler that runs on document deletion. You may get rid of unwanted attachments from the file system by trapping PostDelete event of database.

>> You mentioned that I should avoid between 1-4 a.m. Why? This seems like the ideal time to do it actually...

You got it right, That does seem like the ideal time to do such things. And precisely the reason Domino has chosen that time to do all the house keeping it does. Not that Domino won't run your agents if you schedule at that time. But yes, you can keep it much happier if you don't disturb it while it works to keep the service in shape.

>> if there are two attachments in separate documents with the same name, will this code create two different files or will one overwrite the other? Based on my interpreration of the code, it looks like it's going to name it using like this: PATH\FILENAME(NOTEID).EXT - if so, then that's great.

That has to be the approach. If it doesn't already do that, try modifying it. If you yourself can't, we will help.

>> Finally, how does Notes handle thread priority? Will the server be really sluggish while this is running?

Not really. Unless and untill you have 100s of 1000s of documents and they all contain a couple attachments, you won't be overwhelmng the server. If users try lookups on views while such an agent is running, they may expericence some lag, but that's natural. You can't avoid it. For smaller databases, you might not even notice it.

0
August 16, 2011

Regarding the deletion of the contents of the folder, the volume of data should be in the range of 500-5000 documents. I would prefer not to get too fancy with agents running on modification events, although long term I can see why that approach might be preferable. If you could just tell me how to delete all the files within the folder, which I can run before doing the detachment of all the documents, that will do just fine.

0
August 16, 2011

ok

0
August 16, 2011

That isn't so difficult. Shell out to DELTREE command with a /Y switch. That will delete all the files contained in it. Syntax is:

DELTREE /y C:\Attachments\*.*

that's it.

0
August 16, 2011

Great. Thank you.

0
August 16, 2011

Oh, one more thing - how do I execute the shell command from LotusScript?

0
August 16, 2011

Just put this someplace its executing...

Shell "DELTREE /y C:\Attachments\*.*"

Related Questions

This is the very first question

Hello guys! This is the first post in this site Read More

Views

2k

Votes

4

Answers

2

January 08, 2016

report values not showing up.

I have a crystal report which I pass a DataSet to using VB.NET. The report was working fine, but then I make some changes to the import query and now nothing shows up in the crystal report. Crystal do Read More

Views

1k

Votes

0

Answers

12

September 06, 2005

Event log doesn't overwrite as needed in SP4

Hello All, After upgrading from SP3 to SP4 on several Windows 2000 PRO machines everything looked fine, but from time to time applications can't write to the event log. When I try to view the appl Read More

Views

1k

Votes

0

Answers

9

May 11, 2003

"Failed to self-register XYZ.dll"

Hi there, I wrote a OLE-automation-server DLL in VB4.0. I use Installshield Express to install it as part of my program on the target computers. Now on some computers I get the message "Failed to Read More

Views

2k

Votes

0

Answers

2

November 08, 1998

Please help understand these notes on image processing

Can someone please help me understand these lecture notes... On the right of the page; What does "normalised by one notion of the area of a pixel" mean? On the first formula for A, Is that a Read More

Views

1k

Votes

0

Answers

3

February 05, 2009

Can someone please explain this paragram on the chain rule in image processing

Please see the screenshot, How is 3133030 got from 10103322? Read More

Views

1k

Votes

0

Answers

1

January 05, 2009

AD on 2003

We have created an AD Domain on Windows 2000 Server with no problems. We just created an AD Domain on Windows 2003 and we're getting some weird problems. Both of these domains are behind firewalls Read More

Views

1k

Votes

0

Answers

15

May 11, 2003

ADDT ASP Upload Error " Type mismatch: 'tNG_isFileInsideBaseFolder' "

I am trying to create a simple insert record and upload image function on an ASP page built using Adobe Dreamweaver Developer Toolkit. I have done this many times before with no problem, however, i ha Read More

Views

1k

Votes

0

Answers

0

November 02, 2008

MYSQL Select query with custom ORDER BY

Hi, is it possible to customize the order of the returned rows in mysql? Example: I have a Table with a column "name", now I want to have all entries ordered by name, but I want the entries Read More

Views

1k

Votes

0

Answers

5

July 02, 2010

Folder Redirection in Server 2003

We have a Windows Server 2003 Standard Ed. Is there a way to redirect the users my documents to a folder that has already been created on the server? Read More

Views

1k

Votes

0

Answers

2

July 05, 2007

Partiton magic  version 8.0 having error 1523 while executing batch

I followed the partition magic 8.0 wizard to partition my hard disk while rebooting  I came across this problem  "error 1523 while executing batch" What can I do to solve this prob Read More

Views

1k

Votes

0

Answers

2

May 11, 2003

Please explain this paragraph in image processing (screenshot attached)

Two questions; How is the equation (10.1-15) formed? "are isotropic for rotation increments of 90 degrees and 45 degrees respectively" What does this mean Read More

Views

770

Votes

0

Answers

7

January 05, 2009

xp_cmdshell with net use

Hi, when I use 'net use \192.168.0.1\c$ password /user:username' at the command prompt, it works fine.  But if i try to use it in sql with " exec master..xp_cmdshell 'net use \19 Read More

Views

718

Votes

0

Answers

5

April 11, 2003

hp ux11

i have a hp ux11 server. and i edited the /etc/resolv.conf to use my win2003 server dns server. That went fine, however, I would like to go the other way and add an entry on my win2003 dns to resolve Read More

Views

409

Votes

0

Answers

3

October 12, 2009

Using an application over a LAN

I have written an application that needs to be used on a LAN.  The application setup wizard takes care of registering everything on a single PC, but how do you go about writing a setup program th Read More

Views

358

Votes

0

Answers

9

August 07, 1998

Need subnet of 12 IPs.

Please, Can someone help me to create a subnet consisting of 12 IP's. Thanks.. Read More

Views

366

Votes

0

Answers

5

April 11, 2003

Drill down in a cross-tabl report

Hello, Would some experts to show me if it is possible to do drill-up or drill-down (or both) in a cross-tab report? I would also like to know if it is possible to control what fields to be displayed/ Read More

Views

294

Votes

0

Answers

0

September 06, 2005

Using RDO, Enterprise V Professional

We would like to use RDO on our project made up of 4 developers. Do we need to have a copy of Enterprise for each developer or is it possible to use Professional for those developers not writing the R Read More

Views

347

Votes

0

Answers

6

January 07, 1998

Can't Edit IIS Metabase.xml

We do this on every windows 2003 server and never had an issue. We cannot edit the IIS Metabase.xml We have stopped IIS and made change click save, no problem but it does not take the new information. Read More

Views

349

Votes

0

Answers

0

July 05, 2007

copy directorires - HP UNIX

Let's say my source file is /A/B/C/D/file1, and mytarget directory is /E/F/G, I want the result should look like this. /E/F/G/A/B/C/D/file1 I am using rsync to copy the files older than x no of da Read More

Views

357

Votes

0

Answers

14

September 12, 2009