tracker issue : CF-3041704

select a category, or use search below
(searches all categories and all time range)
Title:

Bug 83429:-(Watson Migration Closure)[ANeff] Bug for: cfsharepoint doesn't scope in/inout parameter valuesI noticed that <cfsharepoint /> does not use its "name" attribute to scope the return value from ’out’ parameters

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/

Reporter/Name(from Bugbase): Aaron Neff / Aaron Neff (Aaron Neff)

Created: 06/22/2010

Components: SharePoint Support

Versions: 9.0

Failure Type:

Found In Build/Fixed In Build: 0000 /

Priority/Frequency: Normal / Few users will encounter

Locale/System: English / Win All

Vote Count: 3

Problem:

[ANeff] Bug for: cfsharepoint doesn't scope in/inout parameter values

I noticed that <cfsharepoint /> does not use its "name" attribute to scope the return value from ’out’ parameters.
Example Copy.GetItem takes "fields" and "stream" as out parameters.

Consider this: 
<cfsharepoint action="getItem" name="local.output" login="#{login creds here}#" params="#{fields=’fields’,stream=’stream’,..}#" wsdl="http://sharepoint.mydomain.com/_vti_bin/Copy.asmx?wsdl" />

CF returns this:- 
local.output- variables.fields (bad!)- variables.stream (bad!)
CF should, IMO, return this (’out’ values added as keys on result variable):- local.output- local.output.fields- local.output.stream

So, the problem is this: cfsharepoint returns ’out’ parameter values into variables scope. I also tried scoping the names of the out parameters, using the tag’s name attribute (local.output), such as: 
<cfsharepoint action="getItem" name="local.output" login="#{login creds here}#" params="#{fields=’local.output.fields’,stream=’local.output.stream’,..}#" wsdl="http://sharepoint.mydomain.com/_vti_bin/Copy.asmx?wsdl" />But no luck. Here CF does not return the values into variables scope or cfsharepoint’s return variable. They appear to just vanish. Can something please be done here, to return values of cfsharepoint out parameters into function-local scope?

Related thread: https://prerelease.adobe.com/r/?af07436e7cc54ad99212426ec688580c

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3041704

External Customer Info:
External Company:  
External Customer Name: Aaron Neff
External Customer Email: 3D1D17B03C844EBF992001AC
External Test Config: 06/22/2010

Attachments:

Comments:

This makes <cfsharepoint> close to unusable. One would normally create the interface between Sharepoint and the CF app via a CFC, and this bug really prevents using <cfsharepoint> in a CFC. -- Adam
Vote by External U.
21936 | November 11, 2011 12:54:37 AM GMT
Pretty much _must_ be fixed if it will ever be used in a CFC.
Vote by External U.
21937 | November 11, 2011 12:54:38 AM GMT
Wow. This should have been caught earlier. Bit of a killer !
Vote by External U.
21938 | November 11, 2011 12:54:40 AM GMT
The following appears to return the result in the specified scope: <cfsharepoint action="getitemsbyids" login="#login#" name="local.result" params="#{strListName="getpics",ids=[2]}#"/> <cfset local.var1= "some val"> <cfdump var="#local#"> (tested with Sharepoint 2010 CF11 HF3) Aaron, I know it has been a while, but by any chance, do you has a public facing WSDL, where I can test this on in/out params as well.
Comment by Piyush K.
21928 | December 05, 2014 11:51:16 AM GMT
Hi Piyush, I will be working on this and follow-up. Thanks!, -Aaron
Comment by External U.
21929 | July 30, 2015 01:55:28 AM GMT
Hi Piyush, Imaging.GetItemsByID does not take "out" parameters and so does not illustrate the issue. Here is a repro case using the Copy.GetItem call, from this ticket's description, which does take "out" parameters and still illustrates the issue in CF11 Update 5: <cfscript> function f() { var theURL = "http://#myLogin.domain#/Shared Documents/mytxt.txt";//be sure this file exists var theParams = {fields='f', stream='s', getItemResult='g', url=theURL};//fields, stream and getItemResult are "out" parameters cfsharepoint(action="getItem", name="local.r", login=myLogin, params=theParams, wsdl="http://#myLogin.domain#/_vti_bin/Copy.asmx?wsdl"); writeDump(local); writeDump(variables); } f(); </cfscript> Actual result: The f, s and g "out" variables are written to the variables scope (and, thus, variables.f no longer references the f() function). If I add the following, then the f, s and g "out" variables are written to the local scope (and variables.f correctly references the f() function): var f = javaCast("null", ""); var s = javaCast("null", ""); var g = javaCast("null", ""); Copy.GetItem doc: https://msdn.microsoft.com/en-us/library/copy.copy.getitem%28v=office.12%29.aspx One way to resolve this would be to have unscoped variables go into the local scope by default =) Thanks!, -Aaron
Comment by External U.
21930 | October 19, 2015 10:28:26 PM GMT
A workaround is to prefix the "out" parameter values. So this: {fields='f', stream='s', getItemResult='g', url=theURL} becomes: {fields='local.f', stream='local.s', getItemResult='local.g', url=theURL} f, s and g are then written to the local scope instead of variables scope. So.. my opinion on this is for Adobe to do 2 things: 1) Leave the existing behavior as-is and document the fact that "out" parameters must be prefixed w/ "local" if developer wants them written to the local scope. 2) Allow us an -option- to have functions write unscoped variables to the local scope by default. Thanks!, -Aaron
Comment by External U.
21931 | October 19, 2015 10:37:16 PM GMT
Hi Aaron, As per the first point when parameters are prepended with local it goes in local scope which is as expected.As per your suggestion we will document this option. Regarding the second point you have made, if we introduce a new option and if that option is set by default unscoped parameters goes to local scope. If we make this changes that will not go with language semantics as there will be many places where similar option would have to be introduced. Currently we will not incorporate this change. Thanks Datta
Comment by Dattanand M.
21932 | December 14, 2015 07:03:45 AM GMT
Hi Dattanand, Thank you regarding #1. Regarding #2, I realize that is outside the scope of this ticket (a proper ticket likely exists - I'll search later). But, to clarify: I think many developers want unscoped variables in UDFs to go into local scope by default. I realize changing that default would break backward-compat for anyone relying on unscoped variables going into the variables scope. That's why I was asking for an -option- (not a change in default) to enable the new behavior. But, anyways, that's outside the scope of this ticket. So no need to discuss further here. Thanks!, -Aaron
Comment by External U.
21933 | December 14, 2015 08:57:59 AM GMT
Hi Dattanand, Regarding #1, the issue was: I didn't know how to use SharePoint's "out" parameters. If you see in the description, I did try local-scoping them. Where I went wrong was I'd assumed "out" parameters would get returned as part of cfsharepoint's result variable (the name="local.output") bit. Looking at this again, years later, it all makes more sense :) I think the cfsharepoint docs should have a note: -------------------------------------------- SharePoint "out" parameters do not get returned as part of the variable created by cfsharepoint's name attribute. Instead, they are created as sibling variables and should be scoped appropriately. -------------------------------------------- Thanks!, -Aaron
Comment by External U.
21934 | December 14, 2015 09:19:13 AM GMT
Hi Aaron, with reference to your previous comment we have raised a doc bug Bug# CF-4102653, hence closing this bug. Thanks, Dattanand
Comment by Dattanand M.
21935 | December 23, 2015 01:21:13 AM GMT