Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharepoint Lists Backup & Restore #4754

Open
25 of 29 tasks
HiteshRepo opened this issue Nov 30, 2023 · 0 comments
Open
25 of 29 tasks

Sharepoint Lists Backup & Restore #4754

HiteshRepo opened this issue Nov 30, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request lists category of sharepoint service sharepoint

Comments

@HiteshRepo
Copy link
Contributor

HiteshRepo commented Nov 30, 2023

Sharepoint support is not enabled yet
Backup Disabled:

Action Items


Enumeration - #4917

  • All lists
  • All list items
  • All columns
  • All contentTypes
  • All columnLinks
  • All contentTypeColumns

Interfaces - #4916

  • ListInfo - stores List related details like Name, Template, Item count, Modified time and Created time
  • SharepointInfo - to accommodate ListInfo, give appropriate headers and values

APIs - #4917

Package: src/pkg/services/m365/api/lists.go & src/pkg/services/m365/api/lists_pager.go

  • GetLists - to fetch all lists (call config to request list-id and last modified time)
  • GetListByID - to fetch a list by id, also make requests to fetch associated relations (columns, contentTypes) and list items
  • PostList - to create a new list from stored list bytes
  • DeleteList - to delete a list

Packages

Others

Pending issues

Proposal & Analysis

@HiteshRepo HiteshRepo added the enhancement New feature or request label Nov 30, 2023
@HiteshRepo HiteshRepo self-assigned this Nov 30, 2023
HiteshRepo added a commit that referenced this issue Dec 5, 2023
fetches lists and its relationships using Lists client wrapper

#### Does this PR need a docs update or release note?
- [x] ⛔ No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🌻 Feature

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x] ⚡ Unit test
- [x] 💚 E2E
HiteshRepo added a commit that referenced this issue Dec 5, 2023
<!-- PR description-->
introduces sharepoint backup handler
implements lists backup handler
instantiates and propagates the lists backup handler to downstream
add a test for CollectLists

#### Does this PR need a docs update or release note?
- [x] ⛔ No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🌻 Feature

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x] ⚡ Unit test
- [x] 💚 E2E
@HiteshRepo HiteshRepo changed the title Sharepoint Lists Backup Sharepoint Lists Backup & Restore Dec 11, 2023
@HiteshRepo HiteshRepo added sharepoint lists category of sharepoint service labels Dec 11, 2023
HiteshRepo added a commit that referenced this issue Dec 12, 2023
Pager implementation for lists and associated relationships

#### Does this PR need a docs update or release note?
- [x] ⛔ No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🌻 Feature

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x] ⚡ Unit test
- [x] 💚 E2E
HiteshRepo added a commit that referenced this issue Dec 15, 2023
fetches fields data of a list item and set its to the list item while
list item enumeration

#### Does this PR need a docs update or release note?
- [x] ⛔ No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🌻 Feature

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x] ⚡ Unit test
- [x] 💚 E2E
HiteshRepo added a commit that referenced this issue Dec 15, 2023
- populates list items count to backup details info
- removes size info from backup details info of sharepoint lists

#### Does this PR need a docs update or release note?
- [x] ⛔ No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🌻 Feature

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x] ⚡ Unit test
- [x] 💚 E2E
HiteshRepo added a commit that referenced this issue Dec 15, 2023
- enables sharepoint lists category for backup
- tests at cli and operation level


#### Does this PR need a docs update or release note?
- [x] ⛔ No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🌻 Feature

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x] ⚡ Unit test
- [x] 💚 E2E
HiteshRepo added a commit that referenced this issue Dec 15, 2023
adds lists restore handler to:
- create list
- create list items
- delete list

#### Does this PR need a docs update or release note?
- [x] ⛔ No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🌻 Feature

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x] ⚡ Unit test
- [x] 💚 E2E
HiteshRepo added a commit that referenced this issue Dec 15, 2023
- adds methods to Lists client wrapper to create list and list items
- adds methods to Lists client wrapper to delete list
- handles graph error: General exception while processing by column
validation nil check
- handles graph error: Unable to identify column definition
- handles location type of columns and its data

#### Does this PR need a docs update or release note?
- [x] ⛔ No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🌻 Feature

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x] ⚡ Unit test
- [x] 💚 E2E
HiteshRepo added a commit that referenced this issue Jan 23, 2024
clubs lists restore tests

#### Does this PR need a docs update or release note?

- [ ] ✅ Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [x] ⛔ No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [x] 🤖 Supportability/Tests
- [ ] 💻 CI/Deployment
- [ ] 🧹 Tech Debt/Cleanup

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x] ⚡ Unit test
- [x] 💚 E2E
HiteshRepo added a commit that referenced this issue Jan 23, 2024
updates lists restore flow for replace collisions

#### Does this PR need a docs update or release note?

- [ ] ✅ Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [x] ⛔ No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [x] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Supportability/Tests
- [ ] 💻 CI/Deployment
- [ ] 🧹 Tech Debt/Cleanup

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x] ⚡ Unit test
- [x] 💚 E2E
HiteshRepo added a commit that referenced this issue Jan 23, 2024
adds patch method to lists client wrapper

#### Does this PR need a docs update or release note?

- [ ] ✅ Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [x] ⛔ No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Supportability/Tests
- [ ] 💻 CI/Deployment
- [ ] 🧹 Tech Debt/Cleanup

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x] ⚡ Unit test
- [x] 💚 E2E
HiteshRepo added a commit that referenced this issue Jan 23, 2024
adds list time selectors

#### Does this PR need a docs update or release note?

- [ ] ✅ Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [x] ⛔ No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Supportability/Tests
- [ ] 💻 CI/Deployment
- [ ] 🧹 Tech Debt/Cleanup

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x] ⚡ Unit test
- [x] 💚 E2E
HiteshRepo added a commit that referenced this issue Jan 23, 2024
removes redundant details fields for lists

#### Does this PR need a docs update or release note?

- [ ] ✅ Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [x] ⛔ No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Supportability/Tests
- [ ] 💻 CI/Deployment
- [x] 🧹 Tech Debt/Cleanup

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x] ⚡ Unit test
- [x] 💚 E2E
HiteshRepo added a commit that referenced this issue Jan 23, 2024
handles lists restore collisions

for collection/site/restore_test, along with tests for lists restore
collision, changes for the refactoring of existing test setup also got
mingled.

#### Does this PR need a docs update or release note?
- [x] ⛔ No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🌻 Feature

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x] ⚡ Unit test
- [x] 💚 E2E
HiteshRepo added a commit that referenced this issue Jan 23, 2024
removes:
- removes unused method: ConsumeRestoreCollections
- removes inconsequential
TestSharePointHandler_ConsumeRestoreCollections_noErrorOnLists

#### Does this PR need a docs update or release note?

- [ ] ✅ Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [x] ⛔ No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Supportability/Tests
- [ ] 💻 CI/Deployment
- [x] 🧹 Tech Debt/Cleanup

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x] ⚡ Unit test
- [x] 💚 E2E
HiteshRepo added a commit that referenced this issue Jan 23, 2024
- includes GetList in list restore handler
- includes GetListsByCollisionKey in list restore handler
- updates mock list restore handler


#### Does this PR need a docs update or release note?
- [x] ⛔ No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🌻 Feature

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x] ⚡ Unit test
- [x] 💚 E2E
aviator-app bot pushed a commit that referenced this issue Jan 23, 2024
adds local sanity tests for lists

for reference:
- `lists` do not have `folders` concept, they are directly created in a site. As a result cannot be restored to a different folder to test. Therefore they need to be created in adjacent to the 'backed-up' lists. Due to this there is a requirement of `SANITY_TEST_RESTORE_CONTAINER_PREFIX`. Using this, during restore check, this env-var is used to find restored lists.
- Similarly, `SANITY_TEST_SOURCE_CONTAINER` is also used a prefix matcher to filter created test lists
- When exported, lists are stored in local into the provided directory as `<SANITY_TEST_RESTORE_CONTAINER>/Lists/<list-id>/<list-id>.json`

should go in after:
- #5024
- #5026

#### Does this PR need a docs update or release note?
- [x] ⛔ No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 🤖 Supportability/Tests

#### Issue(s)
#4754

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x] ⚡ Unit test
- [x] 💚 E2E
HiteshRepo added a commit that referenced this issue Jan 23, 2024
generates test lists for CI sanity tests

#### Does this PR need a docs update or release note?

- [ ] ✅ Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [x] ⛔ No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [x] 🤖 Supportability/Tests
- [ ] 💻 CI/Deployment
- [ ] 🧹 Tech Debt/Cleanup

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x] ⚡ Unit test
- [x] 💚 E2E
HiteshRepo added a commit that referenced this issue Jan 24, 2024
Adds flag to manage lists restore enablement.
By passing `--allow-lists-restore` flag from sanity tests, we can test
sharepoint list restores.
By default the flag is `false`, hence restore operation will not run
unless the flag is provided.
Also the flag is hidden in CLI.

**Why add this flag?**
This [PR](#5048) enables Backup,
Restore and Export for sharepoint lists.
But some issues have emerged while restore because API response changes:
#5084.
So untill PRs for these issue have been merged, we should block restore
operation.
But allow sanity tests to be able to perform restore operation at the
same time.

#### Does this PR need a docs update or release note?

- [ ] ✅ Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [x] ⛔ No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [x] 🤖 Supportability/Tests
- [ ] 💻 CI/Deployment
- [ ] 🧹 Tech Debt/Cleanup

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x] ⚡ Unit test
- [x] 💚 E2E
HiteshRepo added a commit that referenced this issue Jan 24, 2024
enables sharepoint lists `backup` and `export`.
`restore` is enabled via `--allow-lists-restore` flag and is hidden in
CLI. So that it can be sanity-tested.

#### Does this PR need a docs update or release note?

- [ ] ✅ Yes, it's included
- [x] 🕐 Yes, but in a later PR
- [ ] ⛔ No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Supportability/Tests
- [ ] 💻 CI/Deployment
- [x] 🧹 Tech Debt/Cleanup

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x] ⚡ Unit test
- [x] 💚 E2E
aviator-app bot pushed a commit that referenced this issue Jan 25, 2024
adds CI sanity test steps to github workflow

#### Does this PR need a docs update or release note?
- [x] ⛔ No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [x] 💻 CI/Deployment

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x] ⚡ Unit test
- [x] 💚 E2E
aviator-app bot pushed a commit that referenced this issue Jan 30, 2024
enables lists restore

should go in after #5121

#### Does this PR need a docs update or release note?

- [ ] ✅ Yes, it's included
- [x] 🕐 Yes, but in a later PR
- [ ] ⛔ No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Supportability/Tests
- [ ] 💻 CI/Deployment
- [x] 🧹 Tech Debt/Cleanup

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x] ⚡ Unit test
- [x] 💚 E2E
aviator-app bot pushed a commit that referenced this issue Jan 30, 2024
makes backup of lists explicit and not by default.

**Backup whole site**:
```
corso backup create sharepoint --site https://10rqc2.sharepoint.com/sites/CorsoCI

Completed Backups:
  ID                                    Started at            Duration       Status     Protected resource                           Data     
  4a324fd8-dcfc-4833-961f-316d11da34e9  2024-01-30T05:45:24Z  21.530965673s  Completed  https://10rqc2.sharepoint.com/sites/CorsoCI  Libraries
  

corso backup details sharepoint --backup 4a324fd8-dcfc-4833-961f-316d11da34e9

ID            ItemName                                     Library         ParentPath                                                                                                            Size    Owner                            Created               Modified            
  15204b287c5c  wat.jpg                                      More Documents  test                                                                                                                  6.1 kB  [email protected]  2023-03-24T20:33:46Z  2023-03-24T20:33:46Z
  69f63c25d3f1  test-file.txt                                Documents       Corso_Test_od_restore_and_backup_multi_30-Jan-2024_05-06-04.380107/b                                                  387 B                                    2024-01-30T05:06:09Z  2024-01-30T05:06:09Z
  c2d55ecb218f  test-file.txt                                Documents       Corso_Test_od_restore_and_backup_multi_30-Jan-2024_05-06-04.380107/folder-a                                           131 B                                    2024-01-30T05:06:11Z  2024-01-30T05:06:12Z
  5d38274759fd  test-file.txt                                Documents       Corso_Test_od_restore_and_backup_multi_30-Jan-2024_05-06-04.380107                                                    87 B                                     2024-01-30T05:06:06Z  2024-01-30T05:06:07Z
  b5c075c00737  test-file.txt                                Documents       Corso_Test_od_restore_and_backup_multi_30-Jan-2024_05-06-04.380107/folder-a/b/folder-a                                387 B                                    2024-01-30T05:06:16Z  2024-01-30T05:06:17Z
 ...
 ...
```

**Backup lists explicitely**:
```
corso backup create sharepoint --site https://10rqc2.sharepoint.com/sites/CorsoCI --data lists
 
 Completed Backups:
  ID                                    Started at            Duration       Status     Protected resource                           Data 
  cf480086-2094-4184-82be-26e2c5c64288  2024-01-30T05:50:35Z  23.605968852s  Completed  https://10rqc2.sharepoint.com/sites/CorsoCI  Lists
 

corso backup details sharepoint --backup cf480086-2094-4184-82be-26e2c5c64288

ID            List                                                                                                                  Items  Created               Modified            
  85d453fd0f13  Corso_Test_Sanity_2024-01-30_05-31-05_e6be57ae-4236-44aa-b506-a5801377f937                                            20     2024-01-30T05:31:15Z  2024-01-30T05:31:18Z
  f8919f072c7c  Corso_Test_Sanity_Restore_20240130_053009_Corso_Test_Sanity_2024-01-30_05-29-33_4fed1e50-f045-4ebb-8a61-8fb608ac9673  20     2024-01-30T05:30:26Z  2024-01-30T05:30:29Z
  821df8ab207d  Corso_Test_Sanity_Restore_20240130_053147_Corso_Test_Sanity_2024-01-30_05-29-33_b44ce328-106c-4880-8e37-e0bbb510ed4d  20     2024-01-30T05:31:58Z  2024-01-30T05:32:02Z
  721f0aadf07f  new-list-name                                                                                                         1      2024-01-19T17:44:26Z  2024-01-29T04:05:42Z
...
...

```

#### Does this PR need a docs update or release note?

- [ ] :white_check_mark: Yes, it's included
- [x] :clock1: Yes, but in a later PR
- [ ] :no_entry: No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] :sunflower: Feature
- [ ] :bug: Bugfix
- [ ] :world_map: Documentation
- [ ] :robot: Supportability/Tests
- [ ] :computer: CI/Deployment
- [x] :broom: Tech Debt/Cleanup

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x] ⚡ Unit test
- [x] 💚 E2E
HiteshRepo added a commit that referenced this issue Jan 30, 2024
adds documentation for sharepoint lists.
should go in after: #5048

#### Does this PR need a docs update or release note?

- [x] ✅ Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [ ] ⛔ No

#### Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [x] 🗺️ Documentation
- [ ] 🤖 Supportability/Tests
- [ ] 💻 CI/Deployment
- [ ] 🧹 Tech Debt/Cleanup

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [ ] 💪 Manual
- [ ] ⚡ Unit test
- [ ] 💚 E2E
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lists category of sharepoint service sharepoint
Projects
None yet
Development

No branches or pull requests

1 participant