Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am using SoapClient to pull data out of a sharepoint list. If its a normal text field it works fine and gives me the image. I can even attach the image to the individual list elements and link it into another field and get the image that way. The problem with that is it asks me to log in to my sharepoint account whenever I access the page, which obviously a normal user of my site will not be able to do. First, if there is a way around this, that will be a sufficient answer because that is my ideal way of doing it.

However, if the better way is to make a picture gallery and then pull the pictures from there then that isn't a problem.

Basically what I need to know is how to use the Imaging library and maybe the GetItemsByIds method? I am very new to soap and sharepoint in general so I appologize for what may be trivial questions but I really need to know how to do this and I can find no resource on the internet that explains what I need to know (if there is one, link it!). Keep in mind, I have to do this in PHP.

Here is some code that I use to pull the list data:

<?php
  $authParams = array(

  'login' => 'username',
  'password' => 'pass'
);

$listName = "{GUID}";
$rowLimit = '500';
$wsdl = "list.wsdl";
$soapClient = new SoapClient($wsdl, $authParams);

$params = array(
  'listName' => $listName,
  'rowLimit' => $rowLimit;
);

echo file_get_contents($wsdl, FILE_TEXT, stream_context_create(array('http' => array('timeout' => 1))), 0, 1);

$rawXMLresponse = null;
try{
    $rawXMLresponse = $soapClient->GetListItems($params)->GetListItemsResult->any;
}
catch(SoapFault $fault){
    echo 'Fault code: '.$fault->faultcode;
    echo 'Fault string: '.$fault->faultstring;
}
echo '<pre>' . $rawXMLresponse . '</pre>';

$dom = new DOMDocument();
$dom->loadXML($rawXMLresponse);
$results = $dom->getElementsByTagNameNS("#RowsetSchema", "*");
?>

//do the useful thing

<?php
unset($soapClient);
?>
share|improve this question
add comment

1 Answer 1

You should create a service account which the PHP web app will use to pull data from the picture library.

For example, "myphpAppServiceUser", give it a strong password and use that to login.

Then in SharePoint configure that user to only have the mimimal permissions required.

There are several reasons for this as opposed to asking the user for credentials etc.:

  • Security - your app will only have the minimal required access, so any vulnerabilities in the PHP app will have a minimised impact on the SharePoint farm (ie read only access to one library).

  • Auditing/logging - it will be much easier to see in SharePoint logs and PHP/Apache/IIS logs which requests are coming from the PHP application.

  • Useability - users may already be logged into SharePoint, they shouldn't have to do it again if not required. Also the application will not be passing user's credentials around.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.