Hot answers tagged silverlight
11
If you can you should use the Client Object Model (CSOM) - it does not support that many features as the web services but are superior in a number of ways such as:
data types
batching of commands (more efficient usage of bandwith)
optimization of data loaded (more efficient usage of bandwidth)
more similar to the server side object model in terms of ...
10
Ahh, now I see what you're doing. While your approach will work, I tend to prefer the "use a supported method for everyone" approach. The issue with doing this client side is that even if you remove the Silverlight container with Javascript, the browser is still initially going to try and load it.
This is one of my gripes with the SharePoint team; while I ...
7
You actually calling a web service when you use client object model according to this link. Of course use web service is more direct but i dont really care about performance penalty by using Client Object Model. The more concern is productivity improvement by using client object model. But if you more comfortable using web service, you can use it.
4
ClientContext.Current
http://blah.winsmarts.com/2009-12-ClientContextCurrent_is_null_in_Silverlight.aspx
4
You can use Team Foundation Server for UI tests. Chris O'Brien did a presentation on this at the UK Best Practices Conference. You can have a look at his slide deck on his blog at
http://www.sharepointnutsandbolts.com/2011/04/automated-sharepoint-buildsui.html
He's going to be working on some more information on the subject.
4
I had the same problem before. The thing is that sharepoint creates the folder when you add your first attachment, not on creating the item. In other words, the folder you are trying to upload to does not exist.
You can create this folder by either adding a dummy-file and removing it in an ItemAdding EventReceiver when you create the item.
Another ...
3
Client Object Model was designed to work mainly with list data, so the API is somehow limitted. Working with web services does not always mean parsing XML data, you can use REST API (ListData.svc) that will return JSON output. Some webservices allow to switch between SOAP and JSON response format. So, my advice would be use Client Object Model when suitable ...
3
I don't know of anything in the Client Object Model that lets you do this directly, but if you don't want to have to deploy a custom web service, you could probably make a list with a simple workflow that sends an email, and then just have your web part put an entry in the list and make sure it contains the columns you'll need to build the email message in ...
3
why dont you put just the relative link in it? Then it will work in all zones, assuming that you have multiple zones. Than the {siteUrl} token is not needed. Apart from that, I believe that that token doesnt work, only works server-side(for example in masterpages, before the masterpage is rendered). If you check your web.config. If you really want to work ...
3
You cannot/should not use the standard SharePoint object model/API's when creating applications that does not run on the actual SharePoint servers.
Here is a list of the Web Services in WSS 3.0
You need to use the web services to interact with SharePoint, or if you are using SharePoint 2010 then use the Client Object Model. Read this overview of the Client ...
3
You're almost there, using your Files.Add method as shown you can then set properties like this:
File file = docList.RootFolder.Files.Add(myFile);
ListItem item = file.ListItemAllFields;
item["Title"] = "Super Awesome File!";
item.Update();
References:
File.ListItemAllFields Property
ListItem Members
2
I'm not a Silverlight expert, but it should be entirely possible to do what you want. The Client Object Model presents not only lists and list items, but also webs too - since these are what the navigation links are too, all the data you need can be obtained this way.
Effectively you would need to use the following approach:
Get a reference to the current ...
2
You have versioning & permissions in a document library.
Plus, it's easier to load from within a SharePoint Silverlight web part when it's in a document library (you can't load it from the file system if you want to host the Silverlight app in SharePoint, unless you put it in LAYOUTS and load it in manually (probably a bad idea)).
ADDITIONAL:
If ...
2
Check this guide on how to add an application page to a Visual Studio 2010 / SharePoint project.
This is only available for farm solution projects, not for Sandboxed projects so make sure you are not using Sandboxed. For full list of differences between these two click here.
2
The lookup field returns a value of type FieldLookupValue with two properties for retrieving the LookupID and LookupValue, but the multi-lookup field returns FieldLookupValue[] -- and array of FieldLookupValues.
To do what your wanting, just iterate thru the array before binding the values.
I posted a code example of getting at the values of a multi-lookup ...
2
You should configure silverlight project to move file to ../Layouts/ClientBin of your WSP Builder project, when WSP Builder creates a package it will pack it correctly.
This can help you understand the approach in details with UserControls, the same will be for xap files - ...
2
Client Object Model in SharePoint has basically 3 applications, nore requiring SP installed, but for which one you need certain libraries available during development:
1. ECMA Client OM - to be used by Javascript - no SharePoint whatsoever but you need the libraries (SP.js, etc.)
2. Managed - For use from Windows Forms, Console Applications, etc. - in this ...
2
When using the Silverlight Client Object Model you have two way of getting a valid ClientContext.
Either you specify the url of the SharePoint site to work with in the constructor to a ClientContext like this:
ClientContext clientContext = new ClientContext("http://sharepoint");
Or the <object> tag used to load your SilverLight application should ...
2
You could use the Diagnostics service (http://YourSite/_vti_bin/Diagnostics.asmx) as explained here http://msdn.microsoft.com/en-us/library/websvcdiagnostics.sharepointdiagnostics.sendclientscripterrorreport.aspx from any Client technology (Silverlight or Javascript), but it seems you would need to add the clientaccesspolicy.xml to allow access to the web ...
1
You need to load the required properties. Unlike server side object model, context.web will be largely empty until you explicitly load the data.
context = ClientContext.Current;
web = context.Web;
context.Load(web, w => w.Title, w => w.Description, w => w.ServerRelativeUrl);
context.ExecuteQueryAsync(OnSiteLoadSuccess, OnSiteLoadFailure);
...
1
It turns out that this is the security restriction applied by Silverlight's Client Object Model. It can, however, be overcome by adding client access policy file to the root folder of the SharePoint’s web application as described here. More details can be found in this MSDN article.
1
Here's a way to do it:
Uploading of files is done inside the following method:
public File UploadFile(string fileName, System.IO.Stream fileStream, bool overwrite)
{
FileCreationInformation fci;
StringBuilder sb;
File file;
fci = new FileCreationInformation();
fci.Content = this.ReadFully(fileStream);
fci.Overwrite = overwrite;
...
1
I know it may be too late, but i have encountered the same problem and i think i have fixed it.
I had a webpart that contained a usercontrol that generates a form based on a listname contained in the site, listname choosen from the webpart properties, implemented dynamicaly with a editorpart . The problem was that if i inserted two webparts even in ...
1
The best approach depends on the scenario or requirements.
For e.g. if the data you want to consume from external server is a database or web service, then BCS may be a good choice( BCS provides WCF and SQL connectors).You can have the data in External lists and consume it in Silverlight via Client Object Model or a service.
However, if your data source ...
1
Ok, I see a problem in your code snippet - in your foreach loop, you iterate through all pictures returned, but you reference only the first picture (_fileCollection[0]) in every iteration:
foreach (File li in _fileCollection) // <--- you are iterating through whole collection
{
// but in every iteration,
string fileName = ...
1
You'll need a ClientAccessPolicy.xml file in the root of your web application.
Read more about this here:
http://www.dev4side.com/community/blog/2010/8/15/security-error-using-sharepoint-2010-client-object-model-for-silverlight.aspx
1
Declare class level variable:
ListCollection collList = null;
Can you try this:
clContext.Load(collList,lists=>lists.Include(l=>l.Title,l=>l.Description));
By default, Client OM loads Title property. You need to load the other properties of the List object you are trying to access, such as Description, which the above code includes them.
...
1
There's no such built-in functionality. In addition to two methods to achieve your goal from the similar thread provided by Falak Mahmood I can offer another one and easiest in my opinion. You can add an ASP.NET Ajax callback to your web part. Here's an example: http://ajaxzen.wordpress.com/tag/icallbackeventhandler/ Then you need only to call it from client ...
1
I haven't done this myself but a search of MSDN turned up a few things.
This link indicates under the heading WCF Dynamic Configuration that you don't use web.config to register a WCF. Rather you need to use the SharePoint Foundation service factory. Following the links, I found this, this and this which looks like what you want: SPWcfService has a member ...
Only top voted, non community-wiki answers of a minimum length are eligible