Creating a "Mobile Adapter" for Visual Web parts in Sharepoint 2010 - mobile

I've followed this guide on how to create mobile web parts in Sharepoint 2010, but no content is listed when I access the page with a mobile device, or use the "/m"-url. Are there any other sources on how to create a mobile adapter for visual web parts for Sharepoint 2010?
My adapter-class looks like this:
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint.WebPartPages;
using Microsoft.SharePoint;
using Microsoft.SharePoint.MobileControls;
namespace MyProject.MyOrderList
{
public class MyOrderListMobileAdapter : WebPartMobileAdapter
{
protected override void CreateControlsForDetailView()
{
Microsoft.SharePoint.MobileControls.SPMobileLabel lblHello = new Microsoft.SharePoint.MobileControls.SPMobileLabel();
lblHello.Text = "Hello World. This is the Mobile version of the SharePoint web part.";
Controls.Add(lblHello);
}
}
}
I've also added an entry to the "controlAdapters" in the "compat.browser"-file:
<adapter controlType="MyProject.MyOrderList, MyProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=be5098001a913377"
adapterType="MyProject.MyOrderList.MyOrderListMobileAdapter, MyProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=be5098001a913377" />
The safecontrol-entry looks like this:
<SafeControl Assembly="MyProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=be5098001a913377" Namespace="MyProject.MyOrderList" TypeName="*" Safe="True" SafeAgainstScript="False" />
Basicly I want to just create a simplified version of my visual web part without having to create a whole new web part that's just for mobile access, which is what I should be able to accomplish this adapter-method.
Thanks.

Check this out:
Creating a Mobile Adapter for SharePoint 2010
http://allthingsdotnet.net/?p=603
They won't let me post more than one hyperlink, so for the next subject:
Custom VWP Not Visible in Mobile Mode
use the same as above, with this as the querystring - - ?p=518
Also, there's a new application that helps create the correct syntax for the Safe Control section in the Web.Config and the Compat.Browser entry:
Mobile Adapter Tool:
ma.augustwind.com

The MSDN hands on lab was pretty helpful in getting mobile web parts going.
http://msdn.microsoft.com/en-us/sharepointandwindowsphone7trainingcourse_creatingmobilewebpartslab_topic2

Related

Visual studio 2019 and IdentityServer project template

Trying to follow the tutorials for IdentityServer using Visual studio 2019.
As per the instructions created a .Net Core Web Application and then an MVC project type and as per tutorials a welcome screen for IdentityServer should come at run time
But i am getting an MVC page template only like this
Is there any difference in project templates based on new visual studio updates? Or what is the correct selection of project types to get the window similar to the first image ?
It seems you are running the mvc application insteed of the identity provider service.
Go to the solution properties, Common Properties, and select Multiple startup projects. Then change the Action to Start for debug all your projects.
If you prefer start only your identity provider service set it as the Single startup project.

Dynamic loading of modules in Silverlight using Prism and Unity

The basic idea that I'm trying to accomplish is to configure my Silverlight app to resolve its dependencies at runtime (without having to add references to dependent DLLs in the project).
I have my UI project that references an infrastructure project than contains various interfaces (e.g. repositories). Concrete implementations of these interfaces are stored in separate SL apps that I want to download and link to at runtime. I want to be able to configure my UI app from an external config file so that I can switch from one interface implementation to another at runtime without having to recompile the app.
What I have done so far is to create a Prism module for each implementation (in a separate SL app) and get those XAPs hosted in my web project. In my UI app I created a boostraper that has this:
protected override IModuleCatalog CreateModuleCatalog()
{
var mc = Microsoft.Practices.Prism.Modularity.ModuleCatalog.CreateFromXaml(new Uri("/UI;component/Repositories/ModulesCatalog.xaml", UriKind.Relative));
return mc;
}
ModulesCatalog.xaml looks like this:
<Modularity:ModuleCatalog xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:Modularity="clr-namespace:Microsoft.Practices.Prism.Modularity;assembly=Microsoft.Practices.Prism">
<Modularity:ModuleInfo Ref="ImplementationOne.xap"
ModuleName="ImplementationOne"
ModuleType="ImplementationOne.Module, ImplementationOne, Version=1.0.0.0" />
</Modularity:ModuleCatalog>
In my ConfigureContainer override I have:
protected override void ConfigureContainer()
{
var unity = Unity.CreateFromXaml(new Uri("/UI;component/Repositories/UnityConfiguration.xaml", UriKind.Relative));
unity.Containers.Default.Configure(Container);
Container.RegisterInstance<Unity>(Unity.ConfigurationKey, unity);
base.ConfigureContainer();
}
But the unity.Containers.Default.Configure(Container) throws that the assembly cannot be found. (If I manually add the DLL to UI.xap file this works so I guess I'm missing something as the XAP is either not being downloaded or the assembly is not getting registered).
I've been struggling with this for a week now, read lots of SO topics but still cannot solve the problem. All the examples that I have found contain direct project refrences which is exactly what I'm trying to avoid.
Thanks!
To do assembly discovery and dynamic XAP loading you should use MEF container, not Unity.
See more information from official source: http://msdn.microsoft.com/en-us/library/ff921140(v=PandP.40).aspx

Lync API using PresenceIndicator outputting TypeInitializationException within InitializationCompleted

I am using the Lync API within a WPF application. I have used the Office365 Lync Lab 9.1 within the training kit. However when I move the code into my WPF application the PresenceIndicator or ContactList doesn't work. The controls are displayed however the status of the Lync user is not shown. I am using the exact same accounts that are working within the Office365 Training Lab 9.1.
When I add logging I am shown errors like the following for the PresenceIndicator:
Applying template...
Control 'PresenceIndicator' entering 'OnLoaded'
UCClientInitializationFailed:Failed to Create Provider. Error Type: TypeInitializationException
I am also trying the ContactList and that is outputting:
UCClientInitializationFailed:Failed to Create Provider. Error Type: TypeInitializationException
Also the InitializationError property within the InitializationCompleted event is showing an Unknown error. How would I troubleshoot this issue further?
This is a complete stab in the dark, but are you attempting to add controls to an existing WPF application that has never integrated with Lync before?
It may be that you are missing references in your app - double-check you have references to the following files in %program files%\Microsoft Lync\SDK\Assemblies\Desktop
Microsoft.Lync.Controls.dll
Microsoft.Lync.Controls.Framework.dll
Microsoft.Lync.Model.dll
Microsoft.Lync.Utilities.dll
Microsoft.Office.Uc.dll
Also worth checking:
Is your app builing against .NET Framework 3.5 or 4?
Are you building for AnyCPU?
If that doesn't help, you could try creating a new WPF application using the "Lync WPF Application" template in Visual Studio. If this works correctly, then compare this against your appplication for any differences in references, configuration etc.
This MSDN page may be useful.

Silverlight Applications to Access SharePoint 2010 Data is not loading

I am trying to load Silverlight DataGrid Control in my SharePoint 2010, I have followed this code example linl. http://msdn.microsoft.com/en-us/library/ff728647.aspx#Y1200.
I have just replaced this codelines(in MainPage() method):
List Projects = context.Web.Lists.GetByTitle("Calendar");
string camlQueryXml ="asd"+ ""+ "";
Output Error:Could not download the Silverlight application or the Silverlight Plugin did not load.
Check this link
http://msdn.microsoft.com/en-us/library/cc265156(v=vs.95).aspx
The silverlight version selected while creating the application should match with the version of plugin installed.

Silverlight WebPart in SharePoint

I'm making a WebPart for SharePoint that will instantiate a Silverlight UserControl and feed it some data. My problem is that when I have created my sample-WebPart and just instantiate a Silverlight control, the webpart, when added to a page or displayed in the webpart gallery, instead of rendering blank, renders an error page saying "File Not Found". No clue in the logfiles to what file was not found or why this error is thrown. Here is my code:
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.SilverlightControls;
namespace TestSLWP {
public class CustomWebPart1 : WebPart {
protected override void CreateChildControls() {
Label lblHello = new Label();
lblHello.Text = "Hello";
Controls.Add(lblHello);
Silverlight sl = new Silverlight();
}
}
}
I've added references to System.Web.Extensions and System.Web.Silverlight to the project. They are in the GAC, and the webpart is written and compiled on the same computer that SharePoint resides. If I change the CreateChildControls() to be:
protected override void CreateChildControls() {
Silverlight sl = new Silverlight();
sl.ID = "CustomWebPart1SL";
sl.Source = "/Silverlight/CustomWebPart.xap";
this.Controls.Add(sl);
}
I get the same error. Also if I remove the first slash in sl.Source I get the same error, even though the file is present in a virtual directory in the same application pool as SharePoint. I therefore, and because the error comes with just instantiating the Silverlight object, believe that the file that cannot be found is not my XAP.
What file can't SharePoint find and what can I do about it?
Here's the error message:
http://www.freeimagehosting.net/uploads/2dca8dbdfb.png
Hi I found a complete walk through on how to get Silverlight web parts get running on your application: http://www.vbforums.com/archive/index.php/t-557072.html
As you can see there are added some more things to the web.config beside your assembly registration.
Enabling SilverLight requires a lagre amount of web config modifications. Did you add those?
There could be the problem with your storage folder with silverlight control. You must register path to this storage as safe in web.config (for example find in web.config line with "~/controltemplates").

Resources