Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#64487] CreateListCommand for SharePoint (#20390)

Marcello Rocha2c1854e6d500
diff --git a/modules/storages/app/common/storages/adapters/providers/sharepoint/commands/create_list_command.rb b/modules/storages/app/common/storages/adapters/providers/sharepoint/commands/create_list_command.rb
new file mode 100644
index 00000000000..593d9d3f783
--- /dev/null
+++ b/modules/storages/app/common/storages/adapters/providers/sharepoint/commands/create_list_command.rb
@@ -0,0 +1,93 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+module Storages
+ module Adapters
+ module Providers
+ module Sharepoint
+ module Commands
+ class CreateListCommand < Base
+ def call(auth_strategy:, input_data:)
+ Authentication[auth_strategy].call(storage: @storage) do |http|
+ create_list(http, input_data).bind { get_list_properties(http, input_data.name) }
+ end
+ end
+
+ private
+
+ def create_list(http, input_data)
+ handle_response(http.post(request_uri, json: payload(input_data)))
+ end
+
+ def get_list_properties(http, name)
+ handle_response(http.get(list_uri(name))).bind do |entry|
+ Results::StorageFile.build(
+ name: entry[:name],
+ id: entry.dig(:drive, :id).to_s,
+ mime_type: "application/x-op-drive",
+ location: UrlBuilder.path("/", entry[:name]),
+ permissions: %i[readable]
+ )
+ end
+ end
+
+ def handle_response(response)
+ error = Results::Error.new(source: self.class, payload: response)
+
+ case response
+ in { status: 200..299 }
+ Success(response.json(symbolize_keys: true))
+ in { status: 409 }
+ Failure(error.with(code: :conflict))
+ else
+ Failure(error.with(code: :error))
+ end
+ end
+
+ def payload(input_data)
+ { displayName: input_data.name,
+ description: input_data.description,
+ list: { template: "documentLibrary" } }
+ end
+
+ def request_uri
+ endpoint_uri = UrlBuilder.url(base_uri, "/v1.0/sites", host_uri.host)
+ "#{endpoint_uri}:#{site_path}:/lists"
+ end
+
+ def list_uri(name)
+ "#{request_uri}/#{UrlBuilder.path(name)}?$expand=drive&$select=id,name,drive"
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/modules/storages/app/common/storages/adapters/providers/sharepoint/provider_input/create_list.rb b/modules/storages/app/common/storages/adapters/providers/sharepoint/provider_input/create_list.rb
new file mode 100644
index 00000000000..b62a305cea2
--- /dev/null
+++ b/modules/storages/app/common/storages/adapters/providers/sharepoint/provider_input/create_list.rb
@@ -0,0 +1,46 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+module Storages
+ module Adapters
+ module Providers
+ module Sharepoint
+ module ProviderInput
+ CreateList = Data.define(:name, :description) do
+ private_class_method :new
+ def self.build(name:, description: nil, contract: CreateListContract.new)
+ contract.call(name:, description:).to_monad.fmap { new(**it.to_h) }
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/modules/storages/app/common/storages/adapters/providers/sharepoint/provider_input/create_list_contract.rb b/modules/storages/app/common/storages/adapters/providers/sharepoint/provider_input/create_list_contract.rb
new file mode 100644
index 00000000000..22df4c6e739
--- /dev/null
+++ b/modules/storages/app/common/storages/adapters/providers/sharepoint/provider_input/create_list_contract.rb
@@ -0,0 +1,46 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+module Storages
+ module Adapters
+ module Providers
+ module Sharepoint
+ module ProviderInput
+ class CreateListContract < Dry::Validation::Contract
+ params do
+ required(:name).filled(:string)
+ required(:description).maybe(:string)
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/modules/storages/app/common/storages/adapters/providers/sharepoint/queries/open_file_link_query.rb b/modules/storages/app/common/storages/adapters/providers/sharepoint/queries/open_file_link_query.rb
index 237958dda0d..211d888e255 100644
--- a/modules/storages/app/common/storages/adapters/providers/sharepoint/queries/open_file_link_query.rb
+++ b/modules/storages/app/common/storages/adapters/providers/sharepoint/queries/open_file_link_query.rb
@@ -23,7 +23,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
#++
diff --git a/modules/storages/app/common/storages/adapters/results/error.rb b/modules/storages/app/common/storages/adapters/results/error.rb
index 1e3d671d6e1..e34afe267fa 100644
--- a/modules/storages/app/common/storages/adapters/results/error.rb
+++ b/modules/storages/app/common/storages/adapters/results/error.rb
@@ -31,7 +31,7 @@
module Storages
module Adapters
module Results
- Error = ::Data.define(:code, :payload, :source) do
+ Error = Data.define(:code, :payload, :source) do
def initialize(source:, code: nil, payload: nil)
super
end
diff --git a/modules/storages/spec/common/storages/adapters/providers/sharepoint/commands/create_list_command_spec.rb b/modules/storages/spec/common/storages/adapters/providers/sharepoint/commands/create_list_command_spec.rb
new file mode 100644
index 00000000000..27e52cc1c18
--- /dev/null
+++ b/modules/storages/spec/common/storages/adapters/providers/sharepoint/commands/create_list_command_spec.rb
@@ -0,0 +1,106 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+require "spec_helper"
+require_module_spec_helper
+
+module Storages
+ module Adapters
+ module Providers
+ module Sharepoint
+ module Commands
+ RSpec.describe CreateListCommand, :webmock do
+ let(:storage) { create(:sharepoint_storage, :sandbox) }
+
+ let(:site_url) { URI.parse(storage.host).host }
+ let(:input_data) do
+ ProviderInput::CreateList.build(
+ name: "OpenProject Test",
+ description: "A document library used in testing the Create List Command"
+ ).value!
+ end
+
+ let(:auth_strategy) { Registry["sharepoint.authentication.userless"].call }
+
+ it "creates a list", vcr: "sharepoint/create_list_success" do
+ result = described_class.call(storage:, auth_strategy:, input_data:)
+ expect(result).to be_success
+ drive = result.value!
+
+ expect(drive.name).to eq(input_data.name)
+ expect(drive.location).to eq(UrlBuilder.path("/", input_data.name))
+ expect(drive.permissions).to eq([:readable])
+ ensure
+ delete_created_list(input_data.name)
+ end
+
+ it "returns a Results::StorageFile for the list drive", vcr: "sharepoint/create_list_success" do
+ result = described_class.call(storage:, auth_strategy:, input_data:)
+ drive = result.value!
+
+ expect(drive).to be_a(Results::StorageFile)
+ expect(drive.name).to eq(input_data.name)
+ expect(drive.location).to eq(UrlBuilder.path("/", input_data.name))
+ expect(drive.permissions).to eq([:readable])
+ ensure
+ delete_created_list(input_data.name)
+ end
+
+ describe "error handling" do
+ it "returns a conflict error if a list with the same name already exists", vcr: "sharepoint/create_list_conflict" do
+ described_class.call(storage:, auth_strategy:, input_data:)
+ result = described_class.call(storage:, auth_strategy:, input_data:)
+
+ expect(result).to be_failure
+ error = result.failure
+
+ expect(error.code).to eq(:conflict)
+ ensure
+ delete_created_list(input_data.name)
+ end
+ end
+
+ private
+
+ def delete_created_list(name)
+ Authentication[auth_strategy].call(storage:) do |http|
+ http.delete(list_uri(name)).raise_for_status
+ end
+ end
+
+ def list_uri(name)
+ "https://graph.microsoft.com/v1.0/sites/#{site_url}:/sites/OPTest:/lists/#{CGI.escape_uri_component(name)}"
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/modules/storages/spec/common/storages/adapters/providers/sharepoint/validators/authentication_validator_spec.rb b/modules/storages/spec/common/storages/adapters/providers/sharepoint/validators/authentication_validator_spec.rb
index 4de4f75094a..a4802c04580 100644
--- a/modules/storages/spec/common/storages/adapters/providers/sharepoint/validators/authentication_validator_spec.rb
+++ b/modules/storages/spec/common/storages/adapters/providers/sharepoint/validators/authentication_validator_spec.rb
@@ -1,5 +1,33 @@
# frozen_string_literal: true
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
require "spec_helper"
require_module_spec_helper
diff --git a/modules/storages/spec/common/storages/adapters/providers/sharepoint/validators/storage_configuration_validator_spec.rb b/modules/storages/spec/common/storages/adapters/providers/sharepoint/validators/storage_configuration_validator_spec.rb
index a07c3a7bd3a..11f13f30703 100644
--- a/modules/storages/spec/common/storages/adapters/providers/sharepoint/validators/storage_configuration_validator_spec.rb
+++ b/modules/storages/spec/common/storages/adapters/providers/sharepoint/validators/storage_configuration_validator_spec.rb
@@ -1,5 +1,33 @@
# frozen_string_literal: true
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
require "spec_helper"
require_module_spec_helper
diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/sharepoint/create_list_conflict.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/sharepoint/create_list_conflict.yml
new file mode 100644
index 00000000000..73a03542fc1
--- /dev/null
+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/sharepoint/create_list_conflict.yml
@@ -0,0 +1,269 @@
+---
+http_interactions:
+- request:
+ method: post
+ uri: https://login.microsoftonline.com/e36f1dbc-fdae-427e-b61b-0d96ddfb81a4/oauth2/v2.0/token
+ body:
+ encoding: ASCII-8BIT
+ string: grant_type=client_credentials&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default+offline_access&client_id=404e0567-19a1-4a64-b2d1-d3b0c99f2ed9&client_secret=QRB8Q%7Ei.1rID_.MC9FTfRGq-FTE5SgWYsoeLacWf
+ headers:
+ User-Agent:
+ - httpx.rb/1.6.0
+ Accept:
+ - "*/*"
+ Accept-Encoding:
+ - gzip, deflate
+ Content-Type:
+ - application/x-www-form-urlencoded
+ Content-Length:
+ - '199'
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Cache-Control:
+ - no-store, no-cache
+ Pragma:
+ - no-cache
+ Content-Type:
+ - application/json; charset=utf-8
+ Expires:
+ - "-1"
+ Strict-Transport-Security:
+ - max-age=31536000; includeSubDomains
+ X-Content-Type-Options:
+ - nosniff
+ P3p:
+ - CP="DSP CUR OTPi IND OTRi ONL FIN"
+ X-Ms-Request-Id:
+ - 07a7f884-258a-43e9-8bf6-a6735d420d00
+ X-Ms-Ests-Server:
+ - 2.1.21894.4 - NEULR1 ProdSlices
+ X-Ms-Srs:
+ - 1.P
+ Content-Security-Policy-Report-Only:
+ - object-src 'none'; base-uri 'self'; script-src 'self' 'nonce-qbEq1zYez-N1fyI-ncWT5g'
+ 'unsafe-inline' 'unsafe-eval' https://*.msauth.net https://*.msftauth.net
+ https://*.msftauthimages.net https://*.msauthimages.net https://*.msidentity.com
+ https://*.microsoftonline-p.com https://*.microsoftazuread-sso.com https://*.azureedge.net
+ https://*.outlook.com https://*.office.com https://*.office365.com https://*.microsoft.com
+ https://*.bing.com 'report-sample'; report-uri https://csp.microsoft.com/report/ESTS-UX-All
+ Cross-Origin-Opener-Policy-Report-Only:
+ - same-origin; report-to="coop-endpoint"
+ Reporting-Endpoints:
+ - coop-endpoint="https://idux.azurewebsites.net/api/coopReport"
+ X-Xss-Protection:
+ - '0'
+ Set-Cookie:
+ - fpc=Atmg2OFudv1En5EsfY1uWVZZ-dCOAQAAAKlRY-AOAAAA; expires=Wed, 22-Oct-2025
+ 14:18:18 GMT; path=/; secure; HttpOnly; SameSite=None, x-ms-gateway-slice=estsfd;
+ path=/; secure; samesite=none; httponly, stsservicecookie=estsfd; path=/;
+ secure; samesite=none; httponly
+ Date:
+ - Mon, 22 Sep 2025 14:18:17 GMT
+ Content-Length:
+ - '1940'
+ body:
+ encoding: UTF-8
+ string: '{"token_type":"Bearer","expires_in":3599,"ext_expires_in":3599,"access_token":"<ACCESS_TOKEN>"}'
+ recorded_at: Mon, 22 Sep 2025 14:18:18 GMT
+- request:
+ method: post
+ uri: https://graph.microsoft.com/v1.0/sites/ymt6d.sharepoint.com:/sites/OPTest:/lists
+ body:
+ encoding: UTF-8
+ string: '{"displayName":"OpenProject Test","description":"A document library
+ used in testing the Create List Command","list":{"template":"documentLibrary"}}'
+ headers:
+ User-Agent:
+ - httpx.rb/1.6.0
+ Accept:
+ - "*/*"
+ Accept-Encoding:
+ - gzip, deflate
+ Content-Type:
+ - application/json; charset=utf-8
+ Content-Length:
+ - '147'
+ Authorization:
+ - Bearer <BEARER TOKEN>
+ response:
+ status:
+ code: 201
+ message: Created
+ headers:
+ Cache-Control:
+ - no-store, no-cache
+ Content-Type:
+ - application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
+ Content-Encoding:
+ - gzip
+ Etag:
+ - f33aa2d0-e1d2-45b0-b320-ae096763f714,0
+ Location:
+ - https://ymt6d.sharepoint.com/_api/v2.0/sites('ymt6d.sharepoint.com')/lists('f33aa2d0-e1d2-45b0-b320-ae096763f714')
+ Vary:
+ - Accept-Encoding
+ Strict-Transport-Security:
+ - max-age=31536000
+ Request-Id:
+ - bd264548-9ad4-48c6-b631-99bd93ec34ac
+ Client-Request-Id:
+ - bd264548-9ad4-48c6-b631-99bd93ec34ac
+ X-Ms-Ags-Diagnostic:
+ - '{"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"4","ScaleUnit":"005","RoleInstance":"FR3PEPF00000315"}}'
+ Splogid:
+ - 703fc8a1-e012-0000-83a4-aeaf50ccdaa3
+ Odata-Version:
+ - '4.0'
+ Date:
+ - Mon, 22 Sep 2025 14:18:18 GMT
+ body:
+ encoding: UTF-8
+ string: '{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.list)/$entity","@odata.etag":"f33aa2d0-e1d2-45b0-b320-ae096763f714,0","eTag":"f33aa2d0-e1d2-45b0-b320-ae096763f714,0","lastModifiedDateTime":"2025-09-22T14:18:18Z","createdDateTime":"2025-09-22T14:18:18Z","description":"A
+ document library used in testing the Create List Command","id":"f33aa2d0-e1d2-45b0-b320-ae096763f714","name":"OpenProject
+ Test","webUrl":"https://ymt6d.sharepoint.com/sites/OPTest/OpenProject%20Test","displayName":"OpenProject
+ Test","parentReference":{"siteId":"ymt6d.sharepoint.com,1099e315-d0c7-47c7-8640-aa9504b70fff,6af246f0-e3be-45ef-b91a-8eca4dcc5d8f"},"list":{"contentTypesEnabled":false,"hidden":false,"template":"documentLibrary"}}'
+ recorded_at: Mon, 22 Sep 2025 14:18:18 GMT
+- request:
+ method: get
+ uri: https://graph.microsoft.com/v1.0/sites/ymt6d.sharepoint.com:/sites/OPTest:/lists//OpenProject%20Test?$expand=drive&$select=id,name,drive
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ User-Agent:
+ - httpx.rb/1.6.0
+ Accept:
+ - "*/*"
+ Accept-Encoding:
+ - gzip, deflate
+ Authorization:
+ - Bearer <BEARER TOKEN>
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Cache-Control:
+ - no-cache
+ Content-Type:
+ - application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
+ Content-Encoding:
+ - gzip
+ Etag:
+ - '"f33aa2d0-e1d2-45b0-b320-ae096763f714,0"'
+ Vary:
+ - Accept-Encoding
+ Strict-Transport-Security:
+ - max-age=31536000
+ Request-Id:
+ - 1135ac35-9b80-4323-b90a-7ffc0f943b8e
+ Client-Request-Id:
+ - 1135ac35-9b80-4323-b90a-7ffc0f943b8e
+ X-Ms-Ags-Diagnostic:
+ - '{"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"4","ScaleUnit":"005","RoleInstance":"FR3PEPF00000315"}}'
+ Splogid:
+ - 703fc8a1-903d-0000-83a4-a9a936fb4bca
+ Odata-Version:
+ - '4.0'
+ Date:
+ - Mon, 22 Sep 2025 14:18:18 GMT
+ body:
+ encoding: UTF-8
+ string: '{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.list)(id,name,drive,drive())/$entity","@odata.etag":"\"f33aa2d0-e1d2-45b0-b320-ae096763f714,0\"","id":"f33aa2d0-e1d2-45b0-b320-ae096763f714","name":"OpenProject
+ Test","[email protected]":"https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.list)(''f33aa2d0-e1d2-45b0-b320-ae096763f714'')/drive/$entity","drive":{"createdDateTime":"2025-09-22T14:18:18Z","description":"A
+ document library used in testing the Create List Command","id":"b!FeOZEMfQx0eGQKqVBLcP__BG8mq-4-9FuRqOyk3MXY_Qojrz0uGwRbMgrglnY_cU","lastModifiedDateTime":"2025-09-22T14:18:18Z","name":"OpenProject
+ Test","webUrl":"https://ymt6d.sharepoint.com/sites/OPTest/OpenProject%20Test","driveType":"documentLibrary","createdBy":{"user":{"displayName":"SharePoint
+ App"}},"owner":{"group":{"email":"[email protected]","id":"5dfb4269-d3e3-4c70-83f5-c4937ff6dcdb","displayName":"OP
+ Test Owners"}},"quota":{"deleted":4562520,"remaining":27487616731144,"state":"normal","total":27487790694400,"used":169400736}}}'
+ recorded_at: Mon, 22 Sep 2025 14:18:19 GMT
+- request:
+ method: post
+ uri: https://graph.microsoft.com/v1.0/sites/ymt6d.sharepoint.com:/sites/OPTest:/lists
+ body:
+ encoding: UTF-8
+ string: '{"displayName":"OpenProject Test","description":"A document library
+ used in testing the Create List Command","list":{"template":"documentLibrary"}}'
+ headers:
+ Authorization:
+ - Bearer <BEARER TOKEN>
+ User-Agent:
+ - httpx.rb/1.6.0
+ Accept:
+ - "*/*"
+ Accept-Encoding:
+ - gzip, deflate
+ Content-Type:
+ - application/json; charset=utf-8
+ Content-Length:
+ - '147'
+ response:
+ status:
+ code: 409
+ message: Conflict
+ headers:
+ Cache-Control:
+ - no-store, no-cache
+ Content-Type:
+ - application/json
+ Content-Encoding:
+ - gzip
+ Vary:
+ - Accept-Encoding
+ Strict-Transport-Security:
+ - max-age=31536000
+ Request-Id:
+ - 2408694c-bb1b-4127-b470-4f808a96dfeb
+ Client-Request-Id:
+ - 2408694c-bb1b-4127-b470-4f808a96dfeb
+ X-Ms-Ags-Diagnostic:
+ - '{"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"4","ScaleUnit":"005","RoleInstance":"FR3PEPF00000368"}}'
+ Splogid:
+ - 703fc8a1-7053-0000-83a4-aa7d6f14a391
+ Date:
+ - Mon, 22 Sep 2025 14:18:18 GMT
+ body:
+ encoding: UTF-8
+ string: '{"error":{"code":"nameAlreadyExists","message":"Name already exists","innerError":{"date":"2025-09-22T14:18:19","request-id":"2408694c-bb1b-4127-b470-4f808a96dfeb","client-request-id":"2408694c-bb1b-4127-b470-4f808a96dfeb"}}}'
+ recorded_at: Mon, 22 Sep 2025 14:18:19 GMT
+- request:
+ method: delete
+ uri: https://graph.microsoft.com/v1.0/sites/ymt6d.sharepoint.com:/sites/OPTest:/lists/OpenProject%20Test
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ Authorization:
+ - Bearer <BEARER TOKEN>
+ User-Agent:
+ - httpx.rb/1.6.0
+ Accept:
+ - "*/*"
+ Accept-Encoding:
+ - gzip, deflate
+ response:
+ status:
+ code: 204
+ message: No Content
+ headers:
+ Cache-Control:
+ - no-store, no-cache
+ Strict-Transport-Security:
+ - max-age=31536000
+ Request-Id:
+ - 655e9867-75e2-48de-8988-c8810cc3f21d
+ Client-Request-Id:
+ - 655e9867-75e2-48de-8988-c8810cc3f21d
+ X-Ms-Ags-Diagnostic:
+ - '{"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"4","ScaleUnit":"005","RoleInstance":"FR3PEPF00000318"}}'
+ Splogid:
+ - 703fc8a1-a06e-0000-83a4-a516e35abb38
+ Date:
+ - Mon, 22 Sep 2025 14:18:18 GMT
+ body:
+ encoding: UTF-8
+ string: ''
+ recorded_at: Mon, 22 Sep 2025 14:18:19 GMT
+recorded_with: VCR 6.3.1
diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/sharepoint/create_list_success.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/sharepoint/create_list_success.yml
new file mode 100644
index 00000000000..cfa17ec4ca4
--- /dev/null
+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/sharepoint/create_list_success.yml
@@ -0,0 +1,220 @@
+---
+http_interactions:
+- request:
+ method: post
+ uri: https://login.microsoftonline.com/e36f1dbc-fdae-427e-b61b-0d96ddfb81a4/oauth2/v2.0/token
+ body:
+ encoding: ASCII-8BIT
+ string: grant_type=client_credentials&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default+offline_access&client_id=404e0567-19a1-4a64-b2d1-d3b0c99f2ed9&client_secret=QRB8Q%7Ei.1rID_.MC9FTfRGq-FTE5SgWYsoeLacWf
+ headers:
+ User-Agent:
+ - httpx.rb/1.6.0
+ Accept:
+ - "*/*"
+ Accept-Encoding:
+ - gzip, deflate
+ Content-Type:
+ - application/x-www-form-urlencoded
+ Content-Length:
+ - '199'
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Cache-Control:
+ - no-store, no-cache
+ Pragma:
+ - no-cache
+ Content-Type:
+ - application/json; charset=utf-8
+ Expires:
+ - "-1"
+ Strict-Transport-Security:
+ - max-age=31536000; includeSubDomains
+ X-Content-Type-Options:
+ - nosniff
+ P3p:
+ - CP="DSP CUR OTPi IND OTRi ONL FIN"
+ X-Ms-Request-Id:
+ - bb09c284-c71b-4989-8e6a-3e28429b3400
+ X-Ms-Ests-Server:
+ - 2.1.21894.4 - NEULR1 ProdSlices
+ X-Ms-Srs:
+ - 1.P
+ Content-Security-Policy-Report-Only:
+ - object-src 'none'; base-uri 'self'; script-src 'self' 'nonce-fETRoixtsie_6YMZsJ2mpw'
+ 'unsafe-inline' 'unsafe-eval' https://*.msauth.net https://*.msftauth.net
+ https://*.msftauthimages.net https://*.msauthimages.net https://*.msidentity.com
+ https://*.microsoftonline-p.com https://*.microsoftazuread-sso.com https://*.azureedge.net
+ https://*.outlook.com https://*.office.com https://*.office365.com https://*.microsoft.com
+ https://*.bing.com 'report-sample'; report-uri https://csp.microsoft.com/report/ESTS-UX-All
+ Cross-Origin-Opener-Policy-Report-Only:
+ - same-origin; report-to="coop-endpoint"
+ Reporting-Endpoints:
+ - coop-endpoint="https://idux.azurewebsites.net/api/coopReport"
+ X-Xss-Protection:
+ - '0'
+ Set-Cookie:
+ - fpc=AmAN1-4g8LZOnFC4P3cywZ1Z-dCOAQAAADNRY-AOAAAA; expires=Wed, 22-Oct-2025
+ 14:16:20 GMT; path=/; secure; HttpOnly; SameSite=None, x-ms-gateway-slice=estsfd;
+ path=/; secure; samesite=none; httponly, stsservicecookie=estsfd; path=/;
+ secure; samesite=none; httponly
+ Date:
+ - Mon, 22 Sep 2025 14:16:20 GMT
+ Content-Length:
+ - '1935'
+ body:
+ encoding: UTF-8
+ string: '{"token_type":"Bearer","expires_in":3599,"ext_expires_in":3599,"access_token":"<ACCESS_TOKEN>"}'
+ recorded_at: Mon, 22 Sep 2025 14:16:20 GMT
+- request:
+ method: post
+ uri: https://graph.microsoft.com/v1.0/sites/ymt6d.sharepoint.com:/sites/OPTest:/lists
+ body:
+ encoding: UTF-8
+ string: '{"displayName":"OpenProject Test","description":"A document library
+ used in testing the Create List Command","list":{"template":"documentLibrary"}}'
+ headers:
+ User-Agent:
+ - httpx.rb/1.6.0
+ Accept:
+ - "*/*"
+ Accept-Encoding:
+ - gzip, deflate
+ Content-Type:
+ - application/json; charset=utf-8
+ Content-Length:
+ - '147'
+ Authorization:
+ - Bearer <BEARER TOKEN>
+ response:
+ status:
+ code: 201
+ message: Created
+ headers:
+ Cache-Control:
+ - no-store, no-cache
+ Content-Type:
+ - application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
+ Content-Encoding:
+ - gzip
+ Etag:
+ - efbf4ee6-0179-44b3-83cb-84cd48b06f1d,0
+ Location:
+ - https://ymt6d.sharepoint.com/_api/v2.0/sites('ymt6d.sharepoint.com')/lists('efbf4ee6-0179-44b3-83cb-84cd48b06f1d')
+ Vary:
+ - Accept-Encoding
+ Strict-Transport-Security:
+ - max-age=31536000
+ Request-Id:
+ - eefde704-2809-4654-be49-92b9dc10507c
+ Client-Request-Id:
+ - eefde704-2809-4654-be49-92b9dc10507c
+ X-Ms-Ags-Diagnostic:
+ - '{"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"4","ScaleUnit":"006","RoleInstance":"FR1PEPF00001FCB"}}'
+ Splogid:
+ - 533fc8a1-405f-0000-83a4-a989229c2033
+ Odata-Version:
+ - '4.0'
+ Date:
+ - Mon, 22 Sep 2025 14:16:20 GMT
+ body:
+ encoding: UTF-8
+ string: '{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.list)/$entity","@odata.etag":"efbf4ee6-0179-44b3-83cb-84cd48b06f1d,0","eTag":"efbf4ee6-0179-44b3-83cb-84cd48b06f1d,0","lastModifiedDateTime":"2025-09-22T14:16:21Z","createdDateTime":"2025-09-22T14:16:21Z","description":"A
+ document library used in testing the Create List Command","id":"efbf4ee6-0179-44b3-83cb-84cd48b06f1d","name":"OpenProject
+ Test","webUrl":"https://ymt6d.sharepoint.com/sites/OPTest/OpenProject%20Test","displayName":"OpenProject
+ Test","parentReference":{"siteId":"ymt6d.sharepoint.com,1099e315-d0c7-47c7-8640-aa9504b70fff,6af246f0-e3be-45ef-b91a-8eca4dcc5d8f"},"list":{"contentTypesEnabled":false,"hidden":false,"template":"documentLibrary"}}'
+ recorded_at: Mon, 22 Sep 2025 14:16:21 GMT
+- request:
+ method: get
+ uri: https://graph.microsoft.com/v1.0/sites/ymt6d.sharepoint.com:/sites/OPTest:/lists//OpenProject%20Test?$expand=drive&$select=id,name,drive
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ User-Agent:
+ - httpx.rb/1.6.0
+ Accept:
+ - "*/*"
+ Accept-Encoding:
+ - gzip, deflate
+ Authorization:
+ - Bearer <BEARER TOKEN>
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Cache-Control:
+ - no-cache
+ Content-Type:
+ - application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
+ Content-Encoding:
+ - gzip
+ Etag:
+ - '"efbf4ee6-0179-44b3-83cb-84cd48b06f1d,0"'
+ Vary:
+ - Accept-Encoding
+ Strict-Transport-Security:
+ - max-age=31536000
+ Request-Id:
+ - a23e4c61-372c-4802-bb97-ee5ab32ab287
+ Client-Request-Id:
+ - a23e4c61-372c-4802-bb97-ee5ab32ab287
+ X-Ms-Ags-Diagnostic:
+ - '{"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"4","ScaleUnit":"006","RoleInstance":"FR1PEPF00001FCB"}}'
+ Splogid:
+ - 533fc8a1-80aa-0000-83a4-a0a536197857
+ Odata-Version:
+ - '4.0'
+ Date:
+ - Mon, 22 Sep 2025 14:16:21 GMT
+ body:
+ encoding: UTF-8
+ string: '{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.list)(id,name,drive,drive())/$entity","@odata.etag":"\"efbf4ee6-0179-44b3-83cb-84cd48b06f1d,0\"","id":"efbf4ee6-0179-44b3-83cb-84cd48b06f1d","name":"OpenProject
+ Test","[email protected]":"https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.list)(''efbf4ee6-0179-44b3-83cb-84cd48b06f1d'')/drive/$entity","drive":{"createdDateTime":"2025-09-22T14:16:21Z","description":"A
+ document library used in testing the Create List Command","id":"b!FeOZEMfQx0eGQKqVBLcP__BG8mq-4-9FuRqOyk3MXY_mTr_veQGzRIPLhM1IsG8d","lastModifiedDateTime":"2025-09-22T14:16:21Z","name":"OpenProject
+ Test","webUrl":"https://ymt6d.sharepoint.com/sites/OPTest/OpenProject%20Test","driveType":"documentLibrary","createdBy":{"user":{"displayName":"SharePoint
+ App"}},"owner":{"group":{"email":"[email protected]","id":"5dfb4269-d3e3-4c70-83f5-c4937ff6dcdb","displayName":"OP
+ Test Owners"}},"quota":{"deleted":4522248,"remaining":27487616771416,"state":"normal","total":27487790694400,"used":169400736}}}'
+ recorded_at: Mon, 22 Sep 2025 14:16:22 GMT
+- request:
+ method: delete
+ uri: https://graph.microsoft.com/v1.0/sites/ymt6d.sharepoint.com:/sites/OPTest:/lists/OpenProject%20Test
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ Authorization:
+ - Bearer <BEARER TOKEN>
+ User-Agent:
+ - httpx.rb/1.6.0
+ Accept:
+ - "*/*"
+ Accept-Encoding:
+ - gzip, deflate
+ response:
+ status:
+ code: 204
+ message: No Content
+ headers:
+ Cache-Control:
+ - no-store, no-cache
+ Strict-Transport-Security:
+ - max-age=31536000
+ Request-Id:
+ - 2eb5600c-d639-45f0-a545-099491731c3e
+ Client-Request-Id:
+ - 2eb5600c-d639-45f0-a545-099491731c3e
+ X-Ms-Ags-Diagnostic:
+ - '{"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"4","ScaleUnit":"006","RoleInstance":"FR1PEPF00001FC1"}}'
+ Splogid:
+ - 533fc8a1-50c9-0000-83a4-a60967e1706b
+ Date:
+ - Mon, 22 Sep 2025 14:16:22 GMT
+ body:
+ encoding: UTF-8
+ string: ''
+ recorded_at: Mon, 22 Sep 2025 14:16:22 GMT
+recorded_with: VCR 6.3.1