SharePoint online can't find SPSite, SPWeb, SPFolder - forms

I'm using InfoPath 2012, VIsual studio 2012 and SharePoint online.
I'm creating form in infopath that can save files to the SP library, i found this article http://www.bizsupportonline.net/blog/2010/upload-document-sharepoint-infopath-form.htm , I made all like in this article, but I can't connetc to the SPSite, SPWeb, SPFolder.
This is the code that makes errors:
// Add the file to a document library
using (SPSite site = new SPSite("https://contoso.sharepoint.com/Blog/Shared%20Documents"))
{
using (SPWeb web = site.OpenWeb())
{
web.AllowUnsafeUpdates = true;
SPFolder docLib = web.Folders["Documents"];
docLib.Files.Add(fileName, data);
web.AllowUnsafeUpdates = false;
web.Close();
}
site.Close();
}
Mayby someone have any ideas?
I already download the dll library, but it is not help
https://www.nuget.org/packages/Microsoft.SharePointOnline.CSOM/

You cannot run code behind in an InfoPath form on SharePoint online. You shouldn't use InfoPath at all in SharePoint Online.
Check this: https://sharepoint.stackexchange.com/questions/56617/can-i-use-infopath-code-behind-in-sharepoint-online

Related

get a specific link of downloaded google search site

I want to do the following in C#:
load website in background (google search site)
look into the sourcecode of this site and get a specific link
I tried this before:
Use the WebClient Class to download the String of the website
WebClient client = new WebClient();
string reply = client.DownloadString(url);
client.DownloadFile(gesamter_String, #"C:\neu\localfile.html");
Console.WriteLine(reply);
Use the HTTPClient Class to download the String of the website
string url = hyperlink;
HttpClient client = new HttpClient();
using (HttpResponseMessage response = client.GetAsync(url).Result)
{
using (HttpContent content = response.Content)
{
string result =content.ReadAsStringAsync().Result;
Console.WriteLine(result);
}
}
But the downloaded or displayed sourcecode is very small and doesn't contain the specific link.
However my links works. I have opened the link in foreground with this: System.Diagnostics.Process.Start(url);. This foreground opened site contains the full sourcecode.
Thanks a lot.

How to upload file from a REST API with laravel5

i am new to laravel and having an issue regarding REST API over file processing,and i am using dingo laravel api
Here what i have done so for
$user = User::findOrFail($request->user_id);
$user->first_name = $request->first_name;
$user->avatar = $request->file('userfile');
if($user->save()){
return response()->json($user, 200);
}
How do i post a file or image from api and then store in upload folders physically ?
I am able to post data without file.
Any help will be highly appreciated.

hide database location from title bar in microsoft office access 2013

In microsoft office access 2013, the full path of file location appears in the title bar, how to force access 2013 to show only the file name like the access 2010?
I found the solution out on my own:
you can set it manually by clicking on File-> Options -> Current Database, then set the application title.
and you can update the access application using Microsoft.Office.Interop.Access via C# code as follow:
try
{
Microsoft.Office.Interop.Access.Dao.Property p = AccessApplication.CurrentDb().CreateProperty("AppTitle", 10, accessWorkFile.DisplayName);
AccessApplication.CurrentDb().Properties.Append(p);
AccessApplication.CurrentDb().Properties.Refresh();
}
catch
{
}
AccessApplication.CurrentDb().Properties["AppTitle"].Value = accessWorkFile.DisplayName;
AccessApplication.RefreshTitleBar();

EWS from WebSite using user credentials and windows authentication for intranet

I am trying to understand how I should configure a web site (ASP.Net) that need to pass the user credential and get some mail things
I get different kind of errors depending on the app pool configure,
What is the complete way to do it? I mean code + Configuration ;o)
I don't want to write the user and password but get them through the windows authentication
Thanks
code:
Service = new ExchangeService(ExchangeVersion.Exchange2010_SP2)
{
Url =
new Uri(
"https://xxx/yyy.asmx"),
//UseDefaultCredentials = true doesnt help
};
var view = new ItemView(1820);
// Find the first email message in the Inbox that has attachments. This results
FindItemsResults<Item> results = Service.FindItems(folderName, view);
//Here I get the error 401
Take a look at Get started with EWS Managed API client applications, it covers the basics to get you up and rolling. Note that when you use UseDefaultCredentials, you have to be on a domain joined machine, with the user logged in, and you must be targeting an on-prem server. We tested that scenario out and the following code works in that scenario.
using System;
using Microsoft.Exchange.WebServices.Data;
namespace HelloWorld
{
class Program
{
static void Main()
{
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
service.UseDefaultCredentials = true;
service.TraceEnabled = true;
service.TraceFlags = TraceFlags.All;
//Replace the URL below with your own, but using AutoDiscover is recommended instead
service.Url = new Uri("https://computer.domain.contoso.com/EWS/Exchange.asmx");
FindItemsResults<Item> results = service.FindItems(WellKnownFolderName.Inbox,
new ItemView(1));
}
}
}
If that doesn't work for you, then you might want to try using impersonation. See this thread, where I think they've got a similar situation . More information about impersonation is on MSDN: Impersonation and EWS in Exchange.

WP7 Facebook integration using C# SDK

I want my game player to able to post game score to his facebook wall from WP7 game. I have gone through following tutorials
1> Tutorial: Logging Into Facebook with Windows Phone 7 (Silverlight) (source code is downloaded from their website.)
PROBLEM: After running sample project, i can login to facebook, but can't figure out how to post the message.
2> I have download sample project from github.
PROBLEM: When i open the project for WP7, a window pop up saying "Solution folder are not supported in this version of application. solution folder '.nudget' will be displayed as unavailable."
I have tried downloading nuget updates as suggested by Prabir's Blog.
3> With this tutorial, i am able to login to facebook.
PROBLEM: unable to post any message. it display inside emulator "The remote server returned an error:NotFound".
please let me know if you find this question inappropriate or lack of research, i will romove question immediately.
I am novice to both WP7 and C#. Please help me to correct above problems.
Thanks in advance
EDIT : Finally got 3rd one working by making small changes in PGLogin.xaml.cs, just change "PRE" to "pre" in "wbLogin_LoadCompleted" method. but still not much satisfy. because its work and sometime don't. it's not stable. and don't know how to logout. any suggestion?
Another user had this exact issue, it was resolved using the following code:
var args = new Dictionary<string, object>();
args["name"] = "Check this out";
args["link"] = "www.xyz.com";
args["caption"] = "";
args["description"] = "description";
args["picture"] = "";
args["message"] = "Check this out";
args["actions"] = "";
FacebookAsyncCallback callBack = new FacebookAsyncCallback(this.postResult);
fbApp.PostAsync("me/feed", args, callBack);
private void postResult(FacebookAsyncResult asyncResult)
{
System.Diagnostics.Debug.WriteLine(asyncResult);
}
Post to Facebook wall using WP7 and Facebook.dll
ShareLinkTask shareLinkTask = new ShareLinkTask();
shareLinkTask.Title = "Divum Photo Browser";
shareLinkTask.LinkUri = new Uri(list_photos.ElementAt(index_).imageUrl, UriKind.Absolute);
shareLinkTask.Show();