bonjour
J'aurais besoin de récupérer sur disque toutes les PJ d'une liste Sharepoint (il y en a beaucoup)
Je tente une approche via ACCESS
Table Attachée
Manipulation de l'objet PJ/ C'est ok pour l'accès et la visu des PJ mais je bloque sur l'enregistrement sur le disque
Erreur systématique sur FileCopy : numéro ou nom de fichier incorrect
Et save data ne fonctionne pas avec des url
Si quelqu'un à une solution je suis preneur
BOnne journée

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 
Sub SUB_PJ_SAUVE_DD()
Dim bdd As DAO.Database
Dim rs_td_pj As DAO.Recordset
Dim rs_td_pj_fichiers As DAO.Recordset
 
Set bdd = CurrentDb()
Set rs_td_pj = bdd.OpenRecordset("PJ_WS")
 
If rs_td_pj.EOF = False Then
    rs_td_pj.MoveFirst
    Do While Not rs_td_pj.EOF
        Set rs_td_pj_fichiers = rs_td_pj.Fields("Pièces Jointes").Value
        If rs_td_pj_fichiers.EOF = False Then
            rs_td_pj_fichiers.MoveFirst
            Do While Not rs_td_pj_fichiers.EOF
                var_nom_fichier = rs_td_pj_fichiers.Fields("FileName").Value
                var_position = Len(var_nom_fichier)
                var_caractere = Mid(var_nom_fichier, var_position, 1)
                Do While var_caractere <> "/"
                    var_position = var_position - 1
                    var_caractere = Mid(var_nom_fichier, var_position, 1)
                Loop
                var_nom_fichier = Mid(var_nom_fichier, var_position + 1)
                var_path = "c:\PJ\" & var_nom_fichier
                MsgBox ("" & var_nom_fichier) 'MsgBox ("" & rs_td_pj_fichiers.Fields("FileName").Value)
                'Url pour Sharepoint:
                MsgBox ("" & rs_td_pj_fichiers.Fields("FileUrl").Value)
                MsgBox ("" & rs_td_pj_fichiers.Fields("FileType").Value)
                FileCopy rs_td_pj_fichiers.Fields("FileUrl"), var_path
                rs_td_pj_fichiers.MoveNext
            Loop
        End If
        rs_td_pj.MoveNext
    Loop
End If
 
End Sub