Click here to Skip to main content
15,885,032 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
Anyone plz help me with this,(Using Outlook 2010)
i want to copy a mail(from outlook 2010 inbox) automatically from particular sender along with the subject and attachment and save that file into a specific "sharepoint folder " which needs authendication(The autendication must be static since we are using this in particular system with same user name and password).

Also i have to update the mail if another new mail comes with same subject.....

I used a coding and moved file to harddisk saved in .msg format and trying this code to move to sharepoint...... but doen't work :( i think i have to give user name and password somewhere plz help me with this................
VB
Sub Copy_Certain_Files_In_Folder()
Dim FSO As Object
Dim FromPath As String
Dim ToPath As String
Dim FileExt As String
FromPath = "C:\mail"
ToPath = "http://sharepoint"  
FileExt = "*.msg*"  
If Right(FromPath, 1) <> "\" Then
FromPath = FromPath & "\"
End If
Set FSO = CreateObject("scripting.filesystemobject")
If FSO.FolderExists(FromPath) = False Then
MsgBox FromPath & " doesn't exist"
Exit Sub
End If
If FSO.FolderExists(ToPath) = False Then
MsgBox ToPath & " doesn't exist"
Exit Sub
End If
FSO.CopyFile Source:=FromPath & FileExt, Destination:=ToPath
MsgBox "You can find the files from " & FromPath & " in " & ToPath
End Sub

Error:
File does not exist
:(
Posted
Updated 6-Jun-12 0:56am
v2
Comments
Sandeep Mewara 6-Jun-12 6:58am    
Not clear on your issue. Error says 'File does not exists' and you are trying/asking in authentication direction.

1 solution

i got it..............

Public Sub Mailcopy(msg As Outlook.MailItem)
Dim FSO As Object
Dim FromPath As String
Dim ToPath As String
Dim FileExt As String
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
saveFolder = "C:\Temp\" '<< Change
msg.SaveAs saveFolder & Format(msg.Subject, "string") & ".msg", olMSG
FromPath = "C:\Temp" '<< Change
ToPath = "\\sharepoint '<<give network path in ur harddisk not http link
FileExt = "*.msg" '<< Change if u are trying different format
If Right(FromPath, 1) <> "\" Then
FromPath = FromPath & "\"
End If
Set FSO = CreateObject("scripting.filesystemobject")
If FSO.FolderExists(FromPath) = False Then
MsgBox FromPath & "No NEW MAILS"
Exit Sub
End If
If FSO.FolderExists(ToPath) = False Then
MsgBox "LOG IN TO SHAREPOINT"
Exit Sub
End If
FSO.CopyFile Source:=FromPath & FileExt, Destination:=ToPath
MsgBox "Mail from Iniyarathi is copied to sharepoint"
Kill "C:\Temp\*.*" 'Delete the temp files
End Sub



:)Working perfectly
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900