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

Missing Fields #59

Closed
Tukachinchilla opened this issue Apr 30, 2014 · 7 comments
Closed

Missing Fields #59

Tukachinchilla opened this issue Apr 30, 2014 · 7 comments

Comments

@Tukachinchilla
Copy link

Love it, however when I do a get() or query() not all the fields will be returned. I know they exist and they can be interacted with because I am able to do an update or insert action. At first I thought it was only field types with multiple lines of text (that was the first type I noticed) but there does not appear to be any pattern associated with the field type (the multiple lines of text's are all set to plain text just in case you were curious). I have quite a few fields that I have defined (~70+).

@thybag
Copy link
Owner

thybag commented May 1, 2014

Hello,

By default i think sharepoint only returns the fields that are part of the default view. You can get around this when using the query() syntax in a few ways. Easiest is just add the all_fields() option

$sp->query('some list')->all_fields()->get();

Although that can be a little inefficient as it has to do two queries (one to get the fields list from sharepoint, then a second to query the data from them). If you know what the fields are its best just to hardcode them (or maybe just cache them in an array) then pass the list to the fields method:

$sp->query('some list')->fields(array("favroite_cake", "favorite_animal")->get();

The final option would be to create a new view in sharepoint, then get the API to request the list using that view when retriving date. You can do that with the using method.

$sp->query('some list')->using('{SOME-GUID}')->get();

Hope that helps

@Tukachinchilla
Copy link
Author

Thanks for your comment! I tried the all_fields() method but it gave me an error. I also tried creating a view with all fields present, but no joy. I thought that maybe all_fields() was legacy or not supported since it wasn't mentioned in the comments on the API. On initial glance I thought I was using the most recent version of the API but I'll do some more searching as I inherited some parts of the code from a colleague. Thanks again for your reply!

@thybag
Copy link
Owner

thybag commented May 1, 2014

Hmm it should be working - Do you know what version of sharepoint your using?

Probably also worth checking how up to date the copy of the library your using is, as quite a few new features got added a few months back (including a lot of the fields stuff). Biggest give away for the newer versions is it now uses namespacing.

@Tukachinchilla
Copy link
Author

It's a stripped down version of SharePoint for the company, but it might actually be 2010 and not 2007 (2010 introduced the ribbon, which we have). I looked at the API version and here is the relevant parts of the header

@version 2012.12.24

I think it is older. I have tried to play with the newer version but I keep getting ___ class not found errors (I believe related to the namespace?); I change a couple things that clear one class error then another pops up. To be honest I am self taught on many of these things so the old adage of "Knows enough to get into trouble but not out..." applies. I'm not sure if it's an issue with my server config or what (PHP Version 5.5.10 on Windows Server 2008). Thanks for your help so far. I'll keep tinkering and see if anything works. If you see any blatantly obvious fixes let me know ;-)

@thybag
Copy link
Owner

thybag commented May 5, 2014

Hmm, yea the version sounds like its from a fairly old copy of the library.

With the new code, in theory all you should need to do is include the autoloader (either composers if you are using that or the one in /Thybag/SharePointAPI.php), then add a use \Thybag\SharePointAPI; to the top of any php file invoking the SharePointAPI class.

You could alternatively just use the full \Thybag\SharePointAPI namespace when calling class. E.G.

$sp = new \Thybag\SharePointAPI('<username>', '<password>', '<path_to_WSDL>');

Would it be possible to post the errors your getting?

@thybag
Copy link
Owner

thybag commented Aug 5, 2014

Not heard back since my last reply so am closing for now. Feel free to update & i'd be happy to reopen :)

@thybag thybag closed this as completed Aug 5, 2014
@Tukachinchilla
Copy link
Author

I apologize I haven't replied! I found out that there was an error in the display function I wrote to trouble shoot some of the issues. So you're good :-) I've been shipped around the globe since my original post so I haven't had time to try the new version, but I hope to get time eventually.

I appreciate your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants