How to extract all the Document Libraries and Page libraries from a SharePoint site with logic App

92 Views Asked by At

I have a SharePoint site, under site contents i have to extract all the files along with folder structure from "document libraries" and "page libraries" to Azure blob i.e i have to maintain same folder structure and subfolders and files in Blob as it is in SharePoint.

enter image description here

I tried the below flow and unable to achieve due to some errors.

enter image description here

1

There are 1 best solutions below

9
Ikhtesam Afrin On

I am using the below workflow to fetch the library items and page library from SharePoint and subsequently you can add them to blob using create blob (V2) action.

enter image description here

enter image description here enter image description here enter image description here

schema-

{
    "properties": {
        "d": {
            "properties": {
                "results": {
                    "items": {
                        "properties": {
                            "AllowContentTypes": {
                                "type": "boolean"
                            },
                            "Author": {
                                "properties": {
                                    "__deferred": {
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "BaseTemplate": {
                                "type": "integer"
                            },
                            "BaseType": {
                                "type": "integer"
                            },
                            "ContentTypes": {
                                "properties": {
                                    "__deferred": {
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "ContentTypesEnabled": {
                                "type": "boolean"
                            },
                            "CrawlNonDefaultViews": {
                                "type": "boolean"
                            },
                            "CreatablesInfo": {
                                "properties": {
                                    "__deferred": {
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "Created": {
                                "type": "string"
                            },
                            "CurrentChangeToken": {
                                "properties": {
                                    "StringValue": {
                                        "type": "string"
                                    },
                                    "__metadata": {
                                        "properties": {
                                            "type": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "DefaultContentApprovalWorkflowId": {
                                "type": "string"
                            },
                            "DefaultItemOpenUseListSetting": {
                                "type": "boolean"
                            },
                            "DefaultSensitivityLabelForLibrary": {
                                "type": "string"
                            },
                            "DefaultView": {
                                "properties": {
                                    "__deferred": {
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "Description": {
                                "type": "string"
                            },
                            "DescriptionResource": {
                                "properties": {
                                    "__deferred": {
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "Direction": {
                                "type": "string"
                            },
                            "DisableCommenting": {
                                "type": "boolean"
                            },
                            "DisableGridEditing": {
                                "type": "boolean"
                            },
                            "DocumentTemplateUrl": {
                                "type": "string"
                            },
                            "DraftVersionVisibility": {
                                "type": "integer"
                            },
                            "EnableAttachments": {
                                "type": "boolean"
                            },
                            "EnableFolderCreation": {
                                "type": "boolean"
                            },
                            "EnableMinorVersions": {
                                "type": "boolean"
                            },
                            "EnableModeration": {
                                "type": "boolean"
                            },
                            "EnableRequestSignOff": {
                                "type": "boolean"
                            },
                            "EnableVersioning": {
                                "type": "boolean"
                            },
                            "EntityTypeName": {
                                "type": "string"
                            },
                            "EventReceivers": {
                                "properties": {
                                    "__deferred": {
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "ExemptFromBlockDownloadOfNonViewableFiles": {
                                "type": "boolean"
                            },
                            "Fields": {
                                "properties": {
                                    "__deferred": {
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "FileSavePostProcessingEnabled": {
                                "type": "boolean"
                            },
                            "FirstUniqueAncestorSecurableObject": {
                                "properties": {
                                    "__deferred": {
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "ForceCheckout": {
                                "type": "boolean"
                            },
                            "Forms": {
                                "properties": {
                                    "__deferred": {
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "HasExternalDataSource": {
                                "type": "boolean"
                            },
                            "Hidden": {
                                "type": "boolean"
                            },
                            "Id": {
                                "type": "string"
                            },
                            "ImagePath": {
                                "properties": {
                                    "DecodedUrl": {
                                        "type": "string"
                                    },
                                    "__metadata": {
                                        "properties": {
                                            "type": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "ImageUrl": {
                                "type": "string"
                            },
                            "InformationRightsManagementSettings": {
                                "properties": {
                                    "__deferred": {
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "IrmEnabled": {
                                "type": "boolean"
                            },
                            "IrmExpire": {
                                "type": "boolean"
                            },
                            "IrmReject": {
                                "type": "boolean"
                            },
                            "IsApplicationList": {
                                "type": "boolean"
                            },
                            "IsCatalog": {
                                "type": "boolean"
                            },
                            "IsPrivate": {
                                "type": "boolean"
                            },
                            "ItemCount": {
                                "type": "integer"
                            },
                            "Items": {
                                "properties": {
                                    "__deferred": {
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "LastItemDeletedDate": {
                                "type": "string"
                            },
                            "LastItemModifiedDate": {
                                "type": "string"
                            },
                            "LastItemUserModifiedDate": {
                                "type": "string"
                            },
                            "ListExperienceOptions": {
                                "type": "integer"
                            },
                            "ListItemEntityTypeFullName": {
                                "type": "string"
                            },
                            "MajorVersionLimit": {
                                "type": "integer"
                            },
                            "MajorWithMinorVersionsLimit": {
                                "type": "integer"
                            },
                            "MultipleDataList": {
                                "type": "boolean"
                            },
                            "NoCrawl": {
                                "type": "boolean"
                            },
                            "ParentWeb": {
                                "properties": {
                                    "__deferred": {
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "ParentWebPath": {
                                "properties": {
                                    "DecodedUrl": {
                                        "type": "string"
                                    },
                                    "__metadata": {
                                        "properties": {
                                            "type": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "ParentWebUrl": {
                                "type": "string"
                            },
                            "ParserDisabled": {
                                "type": "boolean"
                            },
                            "RoleAssignments": {
                                "properties": {
                                    "__deferred": {
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "RootFolder": {
                                "properties": {
                                    "__deferred": {
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "SensitivityLabelToEncryptOnDOwnloadForLibrary": {},
                            "ServerTemplateCanCreateFolders": {
                                "type": "boolean"
                            },
                            "Subscriptions": {
                                "properties": {
                                    "__deferred": {
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "TemplateFeatureId": {
                                "type": "string"
                            },
                            "Title": {
                                "type": "string"
                            },
                            "TitleResource": {
                                "properties": {
                                    "__deferred": {
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "UserCustomActions": {
                                "properties": {
                                    "__deferred": {
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "VersionPolicies": {
                                "properties": {
                                    "__deferred": {
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "Views": {
                                "properties": {
                                    "__deferred": {
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "WorkflowAssociations": {
                                "properties": {
                                    "__deferred": {
                                        "properties": {
                                            "uri": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "type": "object"
                            },
                            "__metadata": {
                                "properties": {
                                    "etag": {
                                        "type": "string"
                                    },
                                    "id": {
                                        "type": "string"
                                    },
                                    "type": {
                                        "type": "string"
                                    },
                                    "uri": {
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        },
                        "type": "object"
                    },
                    "type": "array"
                }
            },
            "type": "object"
        }
    },
    "type": "object"
}
  • Then you can get the file content and later add it to blob.

enter image description here