• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Has anyone had success with CFSharepoint to access a list on SharePoint Online?

New Here ,
May 20, 2021 May 20, 2021

Copy link to clipboard

Copied

I've been trying to access a list in SharePoint Online using the few examples of sample code found in this forum and elsewhere online.  I'm attempting to use Basic authentication with an account I created in our O365 tenant that does not require MFA or other device trust requirements.  I've changed the password after first logon and have successfully opened and viewed the list in a browser on my computer.

When I try to connect using CFSharepoint from the ColdFusion Server, I always get a 403 Forbidden error.  I don't see any failed logon attempts in the Azure Active Directory logs.

Cannot perform web service invocation getlistitems.
The fault returned when invoking the web service operation is:
AxisFault
 faultCode: {http://xml.apache.org/axis/}HTTP
 faultSubcode: 
 faultString: (403)Forbidden
 faultActor: 
 faultNode: 
 faultDetail: 
	{}:return code:  403
403 FORBIDDEN
	{http://xml.apache.org/axis/}HttpErrorCode:403

 

the code I'm trying is as follows:

<cfset SPUsername = "account@ourdomain.onmicrosoft.com">
<cfset SPPassword = "[thepassword]">

<cfset viewFields = xmlParse("
      <ViewFields>
            <FieldRef Name='Email Address'/>
            <FieldRef Name='Region'/>
	</ViewFields>
")>
<cfset query = xmlParse("
     <Query>
          <OrderBy>
               <FieldRef Name='Email Address'/>
          </OrderBy>
     </Query>
")>
<cfset queryOptions = xmlParse("<QueryOptions></QueryOptions>")>

<cfsharepoint action="getlistitems"
              domain="[ourtenant].sharepoint.com"
              name="spVar"
	      authtype="Basic"
              userName="#SPUsername#"
              password="#SPPassword#"
              params="#{listName="{12345678-1234-1234-1234-123456789012}",
                        viewName="{12345678-1234-1243-1234-123456789012}",
                        query="#query#",
                        rowLimit="20",
                        viewFields="#viewFields#",
                        queryOptions="#queryOptions#",
                        webID=""
                       }#"
/>

<cfset results="#spVar.listitems.data#">
<h1>List</h1>
<ul>
     <cfloop index="i" from="1" to="#arrayLen(results)#">
     <li><cfoutput>#results[i].ows_Title#</cfoutput></li>
     </cfloop>
</ul>

 

I obtained the listname and viewname from the URL used when modifying the view of the list.

 

Any help that anyone can provide would be much appreciated!

 

 

Views

111

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation
Resources
Documentation